We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using idb.js in a worker context on Safari, you get
TransactionInactiveError: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
However, when running the same code in the main context, or on chrome or firefox in the main or in a worker context, it works as expected.
const DB_NAME = "db-123"; const STORE_NAME = "store-name"; const dbPromise = idb.open(DB_NAME, 1, upgradeDB => { upgradeDB.createObjectStore(STORE_NAME); }); const init = async () => { const db = await dbPromise; const txWrite = db.transaction(STORE_NAME, "readwrite"); await txWrite.objectStore(STORE_NAME).put("hello", "foo"); const txRead = db.transaction(STORE_NAME); console.log(type, "got transaction"); const a = await txRead.objectStore(STORE_NAME).get("foo"); console.log(type, "got a", a); const b = await txRead.objectStore(STORE_NAME).get("foo"); console.log(type, "got b", b); }; init().catch(e => console.error(e));
In Safari, this code will output
[Log] MAIN – "got transaction" [Log] MAIN – "got a" – "hello" [Log] MAIN – "got b" – "hello" [Log] WORKER – "got transaction" [Log] WORKER – "got a" – "hello" TransactionInactiveError: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
Whereas in Chrome or Firefox you don't get the TransactionInactiveError.
TransactionInactiveError
There is a sandbox here https://codesandbox.io/s/rj4wnn5lzn
The text was updated successfully, but these errors were encountered:
Sorry I never got to this, but it seems like Safari has fixed the issue.
Sorry, something went wrong.
No branches or pull requests
When using idb.js in a worker context on Safari, you get
TransactionInactiveError: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
However, when running the same code in the main context, or on chrome or firefox in the main or in a worker context, it works as expected.
In Safari, this code will output
Whereas in Chrome or Firefox you don't get the
TransactionInactiveError
.There is a sandbox here https://codesandbox.io/s/rj4wnn5lzn
The text was updated successfully, but these errors were encountered: