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) {
|
if (!db) {
|
||||||
throw Error("db not found");
|
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");
|
throw Error("only allowed while running a transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,7 +1456,7 @@ export class MemoryBackend implements Backend {
|
|||||||
delete this.connectionsByTransaction[btx.transactionCookie];
|
delete this.connectionsByTransaction[btx.transactionCookie];
|
||||||
this.transactionDoneCond.trigger();
|
this.transactionDoneCond.trigger();
|
||||||
|
|
||||||
if (this.afterCommitCallback) {
|
if (this.afterCommitCallback && txLevel >= TransactionLevel.Write) {
|
||||||
await this.afterCommitCallback();
|
await this.afterCommitCallback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"noEmitOnError": true,
|
"noEmitOnError": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"types": []
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user