Check if already rendering before flushing

Forgot to stage this before committing 54e88ed12

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).
This commit is contained in:
Andrew Clark committed 2021-07-10 18:02:00 -04:00
1 parent 54e88ed12c
commit 0f09f14ae6
2 files changed
+4 -2

No files matched your search

@@ -1086,7 +1086,8 @@ export function flushSyncWithoutWarningIfAlreadyRendering<A, R>(
// next event, not at the end of the previous one.
if (
rootWithPendingPassiveEffects !== null &&
rootWithPendingPassiveEffects.tag === LegacyRoot
rootWithPendingPassiveEffects.tag === LegacyRoot &&
(executionContext & (RenderContext | CommitContext)) === NoContext
) {
flushPassiveEffects();
}
@@ -1086,7 +1086,8 @@ export function flushSyncWithoutWarningIfAlreadyRendering<A, R>(
// next event, not at the end of the previous one.
if (
rootWithPendingPassiveEffects !== null &&
rootWithPendingPassiveEffects.tag === LegacyRoot
rootWithPendingPassiveEffects.tag === LegacyRoot &&
(executionContext & (RenderContext | CommitContext)) === NoContext
) {
flushPassiveEffects();
}