Skip to content

Commit 0f09f14

Browse files
committed
Check if already rendering before flushing
Forgot to stage this before committing 54e88ed I don't think is currently observable but should include the guard to protect against regressions (though this whole block will be deleted along with legacy mode, anyway).
1 parent 54e88ed commit 0f09f14

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,8 @@ export function flushSyncWithoutWarningIfAlreadyRendering<A, R>(
10861086
// next event, not at the end of the previous one.
10871087
if (
10881088
rootWithPendingPassiveEffects !== null &&
1089-
rootWithPendingPassiveEffects.tag === LegacyRoot
1089+
rootWithPendingPassiveEffects.tag === LegacyRoot &&
1090+
(executionContext & (RenderContext | CommitContext)) === NoContext
10901091
) {
10911092
flushPassiveEffects();
10921093
}

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,8 @@ export function flushSyncWithoutWarningIfAlreadyRendering<A, R>(
10861086
// next event, not at the end of the previous one.
10871087
if (
10881088
rootWithPendingPassiveEffects !== null &&
1089-
rootWithPendingPassiveEffects.tag === LegacyRoot
1089+
rootWithPendingPassiveEffects.tag === LegacyRoot &&
1090+
(executionContext & (RenderContext | CommitContext)) === NoContext
10901091
) {
10911092
flushPassiveEffects();
10921093
}

0 commit comments

Comments
 (0)