Skip to content

Commit 1eda746

Browse files
committed
fix: prevent unhandled promise rejection from restoration transaction cleanup
Add catch handler to restoration transaction's isPersisted promise to prevent unhandled rejection when rollback() is called during cleanup. The rollback calls reject(undefined) which would otherwise cause an unhandled rejection error.
1 parent cc5d8ba commit 1eda746

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/offline-transactions/src/executor/TransactionExecutor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ export class TransactionExecutor {
269269
mutationFn: async () => {},
270270
})
271271

272+
// Prevent unhandled promise rejection when cleanup calls rollback()
273+
// We don't care about this promise - it's just for holding mutations
274+
restorationTx.isPersisted.promise.catch(() => {
275+
// Intentionally ignored - restoration transactions are cleaned up
276+
// via cleanupRestorationTransaction, not through normal commit flow
277+
})
278+
272279
restorationTx.applyMutations(offlineTx.mutations)
273280

274281
// Register with each affected collection's state manager

0 commit comments

Comments
 (0)