I am trying to implement signalDb with RxDB
Just following this example by signalDb (Here's the source code of this example)
Ang I got this error:
DexieError {_e: Error
at getErrorWithStack (http://localhost:3000/packages/modules.js?hash=85ffa25002a8a31ff006…, name: 'PrematureCommitError', message: 'Transaction committed too early. See link here', inner: null, _promise: DexiePromise, …}
Here's the code:
persistence.ts
const createDatabase = async (dbName) => {
const dbPromise = createRxDatabase({
name: dbName,
storage: getRxStorageDexie(),
});
await dbPromise.then(async (db) => {
const res = await db.waitForLeadership();
await db.addCollections({
todo: {
schema: todoSchema,
},
});
}
}
I hope you can help me to understand or resolve this issue. Thank you in advance