Skip to content

Commit

Permalink
[Fizz] Don't bail out of flushing if we still have pending root tasks (
Browse files Browse the repository at this point in the history
…#27385)

The idea for this check is that we shouldn't flush anything before we
flush the shell. That may or may not hold true in future formats like
RN.

It is a problem for resuming because with resuming it's possible to have
root tasks that are used for resuming but the shell was already flushed
so we can have completed boundaries before the shell has fully resumed.
What matters is whether the parent has already flushed or not.

It's not technically necessary to bail early because there won't be
anything in partialBoundaries or completedBoundaries because nothing
gets added there unless the parent has already flushed.

It's not exactly slow to have to check the length of three arrays so
it's probably not a big deal.

Flush partials in an early preamble needs further consideration
regardless.

DiffTrain build for [df061b3](df061b3)
  • Loading branch information
sebmarkbage committed Sep 18, 2023
1 parent 40090c0 commit 8eacd9a
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a5fc797db14c6e05d4d5c4dbb22a0dd70d41f5d5
df061b396644bb7c27ea76bb27ae09784ce6444b
5 changes: 1 addition & 4 deletions compiled/facebook-www/ReactDOMServer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-classic-0e5abf05";
var ReactVersion = "18.3.0-www-classic-aa8d23ac";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -12734,9 +12734,6 @@ function flushCompletedQueues(request, destination) {
// We haven't flushed the root yet so we don't need to check any other branches further down
return;
}
} else if (request.pendingRootTasks > 0) {
// We have not yet flushed the root segment so we early return
return;
}

if (enableFloat) {
Expand Down
5 changes: 1 addition & 4 deletions compiled/facebook-www/ReactDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (__DEV__) {
var React = require("react");
var ReactDOM = require("react-dom");

var ReactVersion = "18.3.0-www-modern-cdbd1bd5";
var ReactVersion = "18.3.0-www-modern-d883bcc4";

// This refers to a WWW module.
var warningWWW = require("warning");
Expand Down Expand Up @@ -12482,9 +12482,6 @@ function flushCompletedQueues(request, destination) {
// We haven't flushed the root yet so we don't need to check any other branches further down
return;
}
} else if (request.pendingRootTasks > 0) {
// We have not yet flushed the root segment so we early return
return;
}

if (enableFloat) {
Expand Down
3 changes: 1 addition & 2 deletions compiled/facebook-www/ReactDOMServer-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4673,7 +4673,6 @@ function flushCompletedQueues(request, destination) {
request.completedRootSegment = null;
writeBootstrap(destination, request.resumableState);
} else return;
else if (0 < request.pendingRootTasks) return;
var resumableState$jscomp$0 = request.resumableState,
renderState$jscomp$0 = request.renderState;
completedRootSegment = 0;
Expand Down Expand Up @@ -4982,4 +4981,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-classic-a4131db0";
exports.version = "18.3.0-www-classic-23e62ea1";
3 changes: 1 addition & 2 deletions compiled/facebook-www/ReactDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -4641,7 +4641,6 @@ function flushCompletedQueues(request, destination) {
request.completedRootSegment = null;
writeBootstrap(destination, request.resumableState);
} else return;
else if (0 < request.pendingRootTasks) return;
var resumableState$jscomp$0 = request.resumableState,
renderState$jscomp$0 = request.renderState;
completedRootSegment = 0;
Expand Down Expand Up @@ -4950,4 +4949,4 @@ exports.renderToString = function (children, options) {
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server'
);
};
exports.version = "18.3.0-www-modern-1f4ab623";
exports.version = "18.3.0-www-modern-794da4f9";
3 changes: 0 additions & 3 deletions compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -12382,9 +12382,6 @@ function flushCompletedQueues(request, destination) {
// We haven't flushed the root yet so we don't need to check any other branches further down
return;
}
} else if (request.pendingRootTasks > 0) {
// We have not yet flushed the root segment so we early return
return;
}

if (enableFloat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4334,7 +4334,6 @@ function flushCompletedQueues(request, destination) {
request.completedRootSegment = null;
writeBootstrap(destination, request.resumableState);
} else return;
else if (0 < request.pendingRootTasks) return;
var resumableState$jscomp$0 = request.resumableState,
renderState$jscomp$0 = request.renderState;
completedRootSegment = 0;
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactTestRenderer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -24360,7 +24360,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-daf19545";
var ReactVersion = "18.3.0-www-modern-9be4c0a0";

// Might add PROFILE later.

Expand Down

0 comments on commit 8eacd9a

Please sign in to comment.