Skip to content

Commit

Permalink
[Flight] Support postponing through a serialized promise (#27818)
Browse files Browse the repository at this point in the history
Postponing in a promise that is being serialized to the client from the
server should be possible however prior to this change Flight treated
this case like an error rather than a postpone. This fix adds support
for postponing in this position and adds a test asserting you can
successfully prerender the root if you unwrap this promise inside a
suspense boundary.

DiffTrain build for [5bcade5](5bcade5)
  • Loading branch information
gnoff committed Dec 8, 2023
1 parent a163509 commit 7d8a8d9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8ff2c236a233a78c18d6f524dd74baec9153fd37
5bcade5fcf5610e82e7cda05cc6de574bdace0c7
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactDOMTesting-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16449,7 +16449,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1784 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "18.3.0-www-modern-ade0aaf2",
version: "18.3.0-www-modern-faf29095",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2140 = {
Expand Down Expand Up @@ -16480,7 +16480,7 @@ var internals$jscomp$inline_2140 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-www-modern-ade0aaf2"
reconcilerVersion: "18.3.0-www-modern-faf29095"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2141 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16896,4 +16896,4 @@ exports.useFormState = function () {
exports.useFormStatus = function () {
throw Error(formatProdErrorMessage(248));
};
exports.version = "18.3.0-www-modern-ade0aaf2";
exports.version = "18.3.0-www-modern-faf29095";
12 changes: 8 additions & 4 deletions compiled/facebook-www/ReactFlightDOMServer-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,11 +1408,15 @@ if (__DEV__) {
pingTask(request, newTask);
},
function (reason) {
newTask.status = ERRORED;
request.abortableTasks.delete(newTask); // TODO: We should ideally do this inside performWork so it's scheduled
{
newTask.status = ERRORED;

var _digest = logRecoverableError(request, reason);

emitErrorChunk(request, newTask.id, _digest, reason);
}

var digest = logRecoverableError(request, reason);
emitErrorChunk(request, newTask.id, digest, reason);
request.abortableTasks.delete(newTask);

if (request.destination !== null) {
flushCompletedChunks(request, request.destination);
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactFlightDOMServer-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ function serializeThenable(request, thenable) {
},
function (reason) {
newTask.status = 4;
request.abortableTasks.delete(newTask);
reason = logRecoverableError(request, reason);
emitErrorChunk(request, newTask.id, reason);
request.abortableTasks.delete(newTask);
null !== request.destination &&
flushCompletedChunks(request, request.destination);
}
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 @@ -25929,7 +25929,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-www-modern-a95f6e9d";
var ReactVersion = "18.3.0-www-modern-7278ec4c";

// Might add PROFILE later.

Expand Down

0 comments on commit 7d8a8d9

Please sign in to comment.