diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index b6f697edfee38..bb855370faec2 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -1086,7 +1086,8 @@ export function flushSyncWithoutWarningIfAlreadyRendering( // next event, not at the end of the previous one. if ( rootWithPendingPassiveEffects !== null && - rootWithPendingPassiveEffects.tag === LegacyRoot + rootWithPendingPassiveEffects.tag === LegacyRoot && + (executionContext & (RenderContext | CommitContext)) === NoContext ) { flushPassiveEffects(); } diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index 22c8395cb0988..a7b020726e713 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -1086,7 +1086,8 @@ export function flushSyncWithoutWarningIfAlreadyRendering( // next event, not at the end of the previous one. if ( rootWithPendingPassiveEffects !== null && - rootWithPendingPassiveEffects.tag === LegacyRoot + rootWithPendingPassiveEffects.tag === LegacyRoot && + (executionContext & (RenderContext | CommitContext)) === NoContext ) { flushPassiveEffects(); }