Skip to content

Commit

Permalink
[Fizz] Fix Client Render after Postpone (#27905)
Browse files Browse the repository at this point in the history
If we end up client rendering a boundary due to an error after we have
already injected a postponed hole in that boundary we'll end up trying
to target a missing segment. Since we never insert segments for an
already errored boundary into the HTML. Normally an errored prerender
wouldn't be used but if it is, such as if it was an intentional client
error it triggers this case. Those should really be replaced with
postpones though.

This is a bit annoying since we eagerly build up the postponed path. I
took the easy route here and just cleared out the suspense boundary
itself from having any postponed slots. However, this still creates an
unnecessary replay path along the way to the boundary. We could probably
walk the path and remove any empty parent nodes.

What is worse is that if this is the only thing that postponed, we'd
still generate a postponed state even though there's actually nothing to
resume. Since this is a bit of an edge case already maybe it's fine.

In my test I added a check for the `error` event on `window` since this
error only surfaces by throwing an ignored error. We should really do
that globally for all tests. Our tests should fail by default if there's
an error logged to the window.

DiffTrain build for commit f9dddcb.
  • Loading branch information
sebmarkbage committed Jan 9, 2024
1 parent 92eda60 commit 0bdbe43
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25524,7 +25524,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-canary-f1039be4a-20240107";
var ReactVersion = "18.3.0-canary-f9dddcbbb-20240108";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9117,7 +9117,7 @@ var devToolsConfig$jscomp$inline_1037 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-f1039be4a-20240107",
version: "18.3.0-canary-f9dddcbbb-20240108",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1230 = {
Expand Down Expand Up @@ -9148,7 +9148,7 @@ var internals$jscomp$inline_1230 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-f1039be4a-20240107"
reconcilerVersion: "18.3.0-canary-f9dddcbbb-20240108"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9545,7 +9545,7 @@ var devToolsConfig$jscomp$inline_1079 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-f1039be4a-20240107",
version: "18.3.0-canary-f9dddcbbb-20240108",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1271 = {
Expand Down Expand Up @@ -9576,7 +9576,7 @@ var internals$jscomp$inline_1271 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-f1039be4a-20240107"
reconcilerVersion: "18.3.0-canary-f9dddcbbb-20240108"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1272 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-canary-f1039be4a-20240107";
var ReactVersion = "18.3.0-canary-f9dddcbbb-20240108";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-f1039be4a-20240107";
exports.version = "18.3.0-canary-f9dddcbbb-20240108";
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-f1039be4a-20240107";
exports.version = "18.3.0-canary-f9dddcbbb-20240108";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f1039be4a48384e7e4b0a87d4d92c48e900053b9
f9dddcbbb1c0b73f974e78b9488927b778630682

0 comments on commit 0bdbe43

Please sign in to comment.