Skip to content

Fix logins claims update error - #2304

Merged
dfahlander merged 2 commits into
masterfrom
fix-logins-claims-update-error
May 27, 2026
Merged

Fix logins claims update error#2304
dfahlander merged 2 commits into
masterfrom
fix-logins-claims-update-error

Conversation

@dfahlander

@dfahlander dfahlander commented May 27, 2026

Copy link
Copy Markdown
Collaborator

DataError after updating a user in dexie cloud when that user got an update for the $logins table - it tried to clear out "claims.sub" from the changeSpec. Because delByKeyPath has a bug in earlier…] versions of dexie (now solved), this could lead to that the changeSpec got {claims: {}} in it which led to that the actual inline primary key was changed to undefined - causing:

DataError Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.

Summary by CodeRabbit

  • Chores

    • Version updated to 4.4.13
  • Bug Fixes

    • Enhanced primary key handling when applying server-side changes to the database

Review Change Stack

…update for the $logins table - it tried to clear out "claims.sub" from the changeSpec. Because delByKeyPath has a bug in earlier versions of dexie (now solved), this could lead to that the changeSpec got {claims: {}} in it which led to that the actual inline primary key was changed to undefined - causing:

 DataError Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1d9b88a2-b6ad-41b6-8910-5c6903877313

📥 Commits

Reviewing files that changed from the base of the PR and between a024831 and ce12980.

📒 Files selected for processing (2)
  • addons/dexie-cloud/package.json
  • addons/dexie-cloud/src/sync/applyServerChanges.ts

📝 Walkthrough

Walkthrough

The PR refines primary key removal logic in Dexie Cloud's server change application and releases the fix as version 4.4.13. The applyServerChanges function now validates that primary keys are inbound-only with string keyPaths before removal, switching from Dexie.delByKeyPath() to direct property deletion.

Changes

Primary key removal fix and release

Layer / File(s) Summary
Primary key removal logic refinement
addons/dexie-cloud/src/sync/applyServerChanges.ts
The primary key stripping from update changeSpec objects now adds tighter validation: only removes keys when primaryKey is inbound (!primaryKey.outbound) and keyPath is a string, using direct property deletion instead of Dexie.delByKeyPath().
Version bump to 4.4.13
addons/dexie-cloud/package.json
Package version incremented from 4.4.12 to 4.4.13 to release the fix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • dexie/Dexie.js#2277: Also modifies applyServerChanges.ts in the 'update' mutation handling of mut.changeSpecs, adjusting how the primary-key field is removed before bulkUpdate().

Poem

🐰 A tweak to keys, a string to test,
Inbound only—trimming's best!
Direct deletion clears the way,
Version bumps—hooray, hooray! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main fix being implemented (logins claims update error) and aligns with the core change in applyServerChanges.ts related to primary key handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-logins-claims-update-error

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dfahlander
dfahlander merged commit 30134f6 into master May 27, 2026
6 of 7 checks passed
@dfahlander
dfahlander deleted the fix-logins-claims-update-error branch May 27, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant