Open orimay opened 2 months ago
It turns out, it is related to this issue: https://stackoverflow.com/questions/61296252/failed-to-execute-put-on-idbobjectstore-the-transaction-has-finished
IndexDB doesn't really like multiple asynchronous requests. Once I wrapped query in mutex, it worked:
import { Mutex } from 'mutex-ts';
const mutex = new Mutex();
const query = db.query;
db.query = async <T extends unknown[]>(
...args: [string | PreparedQuery, Record<string, unknown> | undefined]
) => {
const release = await mutex.obtain();
try {
return await (query.apply(db, args) as Promise<T>);
} finally {
release();
}
};
mutex-ts is my library.
I am also still getting it sometimes, but not sure how to fix it on my end
Facing the same issue here on surrealdb.js: 1.0.0-beta.14, surrealdb.wasm: 1.0.0-beta.14.
Just re-test in surrealdb.js: 1.0.0-beta.20
and surrealdb.wasm: 1.0.0-beta.16
, it is blocking issue holding back surrealdb.wasm
to be used in any web application.
@limcheekin, you may try using my approach above for the time being
@orimay Thanks, I am aware about your approach, but I am using surrealdb.wasm in a Flutter Web application.
+1
Describe the bug
I keep getting the same error, can't track the root of where it's coming from.
Steps to reproduce
Not sure if this is enough (the project is big), but here's my setup:
Expected behaviour
Should not error out
SurrealDB version
surrealdb.js: 1.0.0-beta.9, surrealdb.wasm: 1.0.0-beta.12
Contact Details
dmitrii.a.baranov@gmail.com
Is there an existing issue for this?
Code of Conduct