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

Regress: undefined entry during iterating records #53

Closed
mnasyrov opened this issue Jul 14, 2020 · 4 comments
Closed

Regress: undefined entry during iterating records #53

mnasyrov opened this issue Jul 14, 2020 · 4 comments

Comments

@mnasyrov
Copy link

The 3.1.0 version introduced a regress bug. The previous 3.0.2 works OK.

I have the following deletion using Dexie.js (3.0.1 version):

db.table('some-table')
  .where('key')
  .startsWith('some-prefix)
  .delete();

It produces the next error:


Error: Could not delete some values. Errors: TypeError: Cannot read property 'key' of undefined

    at /testproject/node_modules/dexie/src/classes/collection/collection.ts:586:36
    at /testproject/node_modules/dexie/src/helpers/promise.js:843:23
    at callListener (/testproject/node_modules/dexie/src/helpers/promise.js:497:19)
    at endMicroTickScope (/testproject/node_modules/dexie/src/helpers/promise.js:583:25)
    at /testproject/node_modules/dexie/src/helpers/promise.js:652:30
    at done (/testproject/node_modules/dexie/src/dbcore/dbcore-indexeddb.ts:194:11)
    at FDBRequest.req.onerror (/testproject/node_modules/dexie/src/dbcore/dbcore-indexeddb.ts:204:11)
    at invokeEventListeners (/testproject/node_modules/fake-indexeddb/build/lib/FakeEventTarget.js:67:31)
    at FDBRequest.Object.<anonymous>.FakeEventTarget.dispatchEvent (/testproject/node_modules/fake-indexeddb/build/lib/FakeEventTarget.js:120:13)
    at FDBTransaction.Object.<anonymous>.FDBTransaction._start (/testproject/node_modules/fake-indexeddb/build/FDBTransaction.js:214:29)
    at processImmediate (internal/timers.js:456:21)
From previous: 
    at DexiePromise.then (/testproject/node_modules/dexie/src/helpers/promise.js:182:22)
    at /testproject/node_modules/dexie/src/classes/collection/collection.ts:585:12
    at /testproject/node_modules/dexie/src/helpers/promise.js:843:23
    at callListener (/testproject/node_modules/dexie/src/helpers/promise.js:497:19)
    at endMicroTickScope (/testproject/node_modules/dexie/src/helpers/promise.js:583:25)
    at FDBRequest.onsuccess (/testproject/node_modules/dexie/src/helpers/promise.js:652:30)
    at invokeEventListeners (/testproject/node_modules/fake-indexeddb/build/lib/FakeEventTarget.js:67:31)
    at FDBRequest.Object.<anonymous>.FakeEventTarget.dispatchEvent (/testproject/node_modules/fake-indexeddb/build/lib/FakeEventTarget.js:120:13)
    at FDBTransaction.Object.<anonymous>.FDBTransaction._start (/testproject/node_modules/fake-indexeddb/build/FDBTransaction.js:214:29)
    at Immediate.<anonymous> (/testproject/node_modules/fake-indexeddb/build/lib/Database.js:26:26)
    at processImmediate (internal/timers.js:456:21)
From previous: 
    at Object.mutate (/testproject/node_modules/dexie/src/dbcore/dbcore-indexeddb.ts:120:14)
    at Object.mutate (/testproject/node_modules/dexie/src/hooks/hooks-middleware.ts:52:28)
    at /testproject/node_modules/dexie/src/classes/collection/collection.ts:584:33
    at /testproject/node_modules/dexie/src/helpers/promise.js:843:23
    at callListener (/testproject/node_modules/dexie/src/helpers/promise.js:497:19)
    at endMicroTickScope (/testproject/node_modules/dexie/src/helpers/promise.js:583:25)
    at FDBRequest.onsuccess (/testproject/node_modules/dexie/src/helpers/promise.js:652:30)
    at invokeEventListeners (/testproject/node_modules/fake-indexeddb/build/lib/FakeEventTarget.js:67:31)
    at FDBRequest.Object.<anonymous>.FakeEventTarget.dispatchEvent (/testproject/node_modules/fake-indexeddb/build/lib/FakeEventTarget.js:120:13)
    at FDBTransaction.Object.<anonymous>.FDBTransaction._start (/testproject/node_modules/fake-indexeddb/build/FDBTransaction.js:214:29)
    at Immediate.<anonymous> (/testproject/node_modules/fake-indexeddb/build/lib/Database.js:26:26)
    at processImmediate (internal/timers.js:456:21)
@dumbmatter
Copy link
Owner

Thanks, I'll try to get to this this week. If you have a self-contained reproduction (ideally without Dexie, but even with Dexie is fine) that would be helpful :)

@mnasyrov
Copy link
Author

I made a test case with Dexie: https://codesandbox.io/s/frosty-platform-nh4ve?file=/src/fidb.test.js

@dumbmatter
Copy link
Owner

Thank you @mnasyrov for the bug report and for the minimal reproduction, that was very helpful! I fixed it in v3.1.1.

@nolanlawson - just tagging you in case you're curious, since the bug was in your recent PR, but I think I handled it :)

@nolanlawson
Copy link
Contributor

@dumbmatter Ah, sorry about that! I was mostly relying on the test cases to catch everything; sorry that I introduced the regression!

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

No branches or pull requests

3 participants