Skip to content

Commit

Permalink
fix: prevent infinite loop when pushing updates
Browse files Browse the repository at this point in the history
Pushing updates would open a readwrite cursor, which would dispatch a
new update event and trigger another round of pushing updates.
  • Loading branch information
darrachequesne committed Mar 26, 2022
1 parent 8fbcc96 commit 0a94d53
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wrap-idb-value.ts
Expand Up @@ -234,7 +234,11 @@ function wrapFunction<T extends Func>(func: T): Function {
}

return function (this: any, ...args: Parameters<T>) {
if (func === IDBDatabase.prototype.transaction && args[1] === 'readwrite') {
if (
func === IDBDatabase.prototype.transaction &&
args[1] === 'readwrite' &&
args[0] !== LOCAL_CHANGES_STORE
) {
if (!Array.isArray(args[0])) {
args[0] = [args[0]];
}
Expand Down

0 comments on commit 0a94d53

Please sign in to comment.