Skip to content

Commit

Permalink
Do not accept listeners on read-only transactions (#1706)
Browse files Browse the repository at this point in the history
  • Loading branch information
lauckhart authored Feb 13, 2025
1 parent fd72520 commit 1187f81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/general/src/transaction/Tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ class Tx implements Transaction {
}

onShared(listener: () => void, once?: boolean) {
if (this.status === Status.ReadOnly) {
return;
}
if (this.#shared === undefined) {
this.#shared = Observable();
}
Expand All @@ -197,6 +200,9 @@ class Tx implements Transaction {
}

onClose(listener: () => void) {
if (this.status === Status.ReadOnly) {
return;
}
if (this.status === Status.Destroyed) {
listener();
}
Expand Down

0 comments on commit 1187f81

Please sign in to comment.