diff options
-rw-r--r-- | packages/idb-bridge/src/MemoryBackend.ts | 5 | ||||
-rw-r--r-- | packages/idb-bridge/tsconfig.json | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/idb-bridge/src/MemoryBackend.ts b/packages/idb-bridge/src/MemoryBackend.ts index e09a28988..4154435a0 100644 --- a/packages/idb-bridge/src/MemoryBackend.ts +++ b/packages/idb-bridge/src/MemoryBackend.ts @@ -1416,7 +1416,8 @@ export class MemoryBackend implements Backend { if (!db) { throw Error("db not found"); } - if (db.txLevel < TransactionLevel.Read) { + const txLevel = db.txLevel; + if (txLevel < TransactionLevel.Read) { throw Error("only allowed while running a transaction"); } @@ -1455,7 +1456,7 @@ export class MemoryBackend implements Backend { delete this.connectionsByTransaction[btx.transactionCookie]; this.transactionDoneCond.trigger(); - if (this.afterCommitCallback) { + if (this.afterCommitCallback && txLevel >= TransactionLevel.Write) { await this.afterCommitCallback(); } } diff --git a/packages/idb-bridge/tsconfig.json b/packages/idb-bridge/tsconfig.json index d3a746e1d..017afdae1 100644 --- a/packages/idb-bridge/tsconfig.json +++ b/packages/idb-bridge/tsconfig.json @@ -9,7 +9,8 @@ "noEmitOnError": true, "strict": true, "incremental": true, - "sourceMap": true + "sourceMap": true, + "types": [] }, "include": ["src/**/*"] } |