Skip to content

Commit f55d172

Browse files
authored
[Fiber] clarify entry condition for suspensey commit recursion (#29222)
Previously Suspensey recursion would only trigger if the ShouldSuspendCommit flag was true. However there is a dependence on the Visibility flag embedded in this logic because these flags share a bit. To make it clear that the semantics of Suspensey resources require considering both flags I've added it to the condition even though this extra or-ing is a noop when the bit is shared
1 parent 84239da commit f55d172

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ import {
126126
MountLayoutDev,
127127
DidDefer,
128128
ShouldSuspendCommit,
129+
MaySuspendCommit,
129130
} from './ReactFiberFlags';
130131
import {
131132
NoLanes,
@@ -1185,7 +1186,13 @@ function commitRootWhenReady(
11851186
) {
11861187
// TODO: Combine retry throttling with Suspensey commits. Right now they run
11871188
// one after the other.
1188-
if (finishedWork.subtreeFlags & ShouldSuspendCommit) {
1189+
const BothVisibilityAndMaySuspendCommit = Visibility | MaySuspendCommit;
1190+
const subtreeFlags = finishedWork.subtreeFlags;
1191+
if (
1192+
subtreeFlags & ShouldSuspendCommit ||
1193+
(subtreeFlags & BothVisibilityAndMaySuspendCommit) ===
1194+
BothVisibilityAndMaySuspendCommit
1195+
) {
11891196
// Before committing, ask the renderer whether the host tree is ready.
11901197
// If it's not, we'll wait until it notifies us.
11911198
startSuspendingCommit();

0 commit comments

Comments
 (0)