Skip to content

Commit c534bc1

Browse files
committed
fix: Remove redundant microtask flush
1 parent 5dc81dc commit c534bc1

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/pure.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,7 @@ configureDTL({
3737
const previousActEnvironment = getIsReactActEnvironment()
3838
setReactActEnvironment(false)
3939
try {
40-
const result = await cb()
41-
// Drain microtask queue.
42-
// Otherwise we'll restore the previous act() environment, before we resolve the `waitFor` call.
43-
// The caller would have no chance to wrap the in-flight Promises in `act()`
44-
await new Promise(resolve => {
45-
setTimeout(() => {
46-
resolve()
47-
}, 0)
48-
49-
if (jestFakeTimersAreEnabled()) {
50-
jest.advanceTimersByTime(0)
51-
}
52-
})
53-
54-
return result
40+
return await cb()
5541
} finally {
5642
setReactActEnvironment(previousActEnvironment)
5743
}

0 commit comments

Comments
 (0)