Skip to content

Commit

Permalink
[Fiber] clarify entry condition for suspensey commit recursion
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gnoff committed May 22, 2024
1 parent 3ac551e commit a409ff2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberWorkLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ function commitRootWhenReady(
) {
// TODO: Combine retry throttling with Suspensey commits. Right now they run
// one after the other.
if (finishedWork.subtreeFlags & ShouldSuspendCommit) {
if (finishedWork.subtreeFlags & (ShouldSuspendCommit | Visibility)) {
// Before committing, ask the renderer whether the host tree is ready.
// If it's not, we'll wait until it notifies us.
startSuspendingCommit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ describe('ReactSuspenseyCommitPhase', () => {
});

// @gate enableActivity
test("host instances don't suspend during prerendering, but do suspend when they are revealed", async () => {
test.only("host instances don't suspend during prerendering, but do suspend when they are revealed", async () => {
function More() {
Scheduler.log('More');
return <SuspenseyImage src="More" />;
Expand Down

0 comments on commit a409ff2

Please sign in to comment.