only invoke afterCommitCallback for transactions that change data
This commit is contained in:
parent
705699b2d2
commit
262885679c
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
"noEmitOnError": true,
|
||||
"strict": true,
|
||||
"incremental": true,
|
||||
"sourceMap": true
|
||||
"sourceMap": true,
|
||||
"types": []
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user