add support for async functions inside doc.transact
This commit is contained in:
parent
ac49dbcbd8
commit
71e95deceb
@ -436,7 +436,13 @@ export const transact = (doc, f, origin = null, local = true) => {
|
||||
// observes throw errors.
|
||||
// This file is full of hacky try {} finally {} blocks to ensure that an
|
||||
// event can throw errors and also that the cleanup is called.
|
||||
cleanupTransactions(transactionCleanups, 0)
|
||||
if (typeof result?.then === 'function' && result?.constructor?.name === 'Promise') {
|
||||
result.then(() => {
|
||||
cleanupTransactions(transactionCleanups, 0)
|
||||
})
|
||||
} else {
|
||||
cleanupTransactions(transactionCleanups, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user