Skip to content

Commit f0f3259

Browse files
authored
fix(transactions): always resolve isPersisted.promise (#376)
1 parent bda3f24 commit f0f3259

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/db/src/transactions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ class Transaction<T extends object = Record<string, unknown>> {
355355

356356
if (this.mutations.length === 0) {
357357
this.setState(`completed`)
358+
this.isPersisted.resolve(this)
358359

359360
return this
360361
}

packages/db/tests/transactions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe(`Transactions`, () => {
2525

2626
transaction.commit()
2727
expect(transaction.state).toBe(`completed`)
28+
expect(transaction.isPersisted.promise).resolves.toBeDefined()
2829
})
2930
it(`thows an error if you don't pass in mutationFn`, () => {
3031
// @ts-expect-error missing argument on purpose

0 commit comments

Comments
 (0)