ipfs / ipfs/js-stores

datastore-idb .query doesn't work as expected

Open
#198 1 comment 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
TypeScript
Stars
38
Forks
27
PR merge metrics
No merged PRs in 30d

Description

`store.query` opens an IndexedDB transaction and uses a cursor to iterate over each entry in the datastore. The transaction closes automatically when the microtask queue is emptied and there's no outstanding work for it to do, even if the cursor is not at the end of the dataset.

Each query result is `yield`ed to the caller which if they do any async work can cause the transaction to close and the next call to `cursor.continue()` to throw `ERROR: DOMException{stack: 'Error: Failed to execute 'continue' on 'IDBCursor': The transaction is not active.`.

https://www.npmjs.com/package/idb/v/5.0.2#transaction-lifetime

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.