Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk put puts duplicate objects into DB even if they share an ID #2012

Closed
clintonmedbery opened this issue Jun 17, 2024 · 2 comments
Closed
Labels

Comments

@clintonmedbery
Copy link

I am using dexie bulkPut with useLiveQuery and in version 4.0.7 we are putting duplicate items into the dexie DB.

I forked a codesandbox that was using 3.2.2 and this was not an issue. I updated Dexie to 4.0.7 and you can see it creates multiple items by pressing Add Friend even though they share an id.

https://codesandbox.io/p/sandbox/eloquent-dirac-lhrmcm

Steps to reproduce:

  1. Click add friend.
  2. See that many items are now in the list.

Is this expected behavior?

@dfahlander
Copy link
Collaborator

Similar to #2011. Bug is in the liveQuery cache. To workaround, create Dexie with cache disabled:

const db = new Dexie('dbName', { cache: 'disabled' });

@dfahlander dfahlander added the bug label Jun 18, 2024
@clintonmedbery
Copy link
Author

Thanks! I will close since this is a dupe.

dfahlander added a commit that referenced this issue Jul 9, 2024
dfahlander added a commit that referenced this issue Jul 9, 2024
…Query cache.

This commit also introduces RangeSet.hasKey() method (to simplify seeking of a key in a rangeset), corrects the typing of IntervalTreeNode and removes some unused imports.

Resolves #2011
Resolves #2012
dfahlander added a commit that referenced this issue Jul 9, 2024
Chech input array for duplicate primary keys before updating the liveQuery cache.

This commit also introduces RangeSet.hasKey() method (to simplify seeking of a key in a rangeset), corrects the typing of IntervalTreeNode and removes some unused imports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants