Skip to content

Commit

Permalink
also wrap asyncWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Nov 27, 2024
1 parent b086f98 commit 6fb6fb1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/useWithoutAct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ export function userEventWithoutAct(
async function wrapped(this: any, ...args: any[]) {
const config = getConfig()
// eslint-disable-next-line @typescript-eslint/unbound-method
const orig = config.eventWrapper
const eventWrapper = config.eventWrapper
// eslint-disable-next-line @typescript-eslint/unbound-method
const asyncWrapper = config.asyncWrapper
try {
config.eventWrapper = cb => cb()
// eslint-disable-next-line @typescript-eslint/return-await
return await (value as Function).apply(this, args)
} finally {
config.eventWrapper = orig
config.asyncWrapper = asyncWrapper
config.eventWrapper = eventWrapper
}
},
]
Expand Down

0 comments on commit 6fb6fb1

Please sign in to comment.