[Fizz] handle errors in onHeaders (#27712)

`onHeaders` can throw however for now we can assume that headers are
optimistic values since the only things we produce for them are preload
links. This is a pragmatic decision because React could concievably have
headers in the future which were not optimistic and thus non-optional
however it is hard to imagine what these headers might be in practice.
If we need to change this behavior to be fatal in the future it would be
a breaking change.

This commit adds error logging when `onHeaders` throws and ensures the
request can continue to render successfully.

DiffTrain build for commit https://github.com/facebook/react/commit/ee68446ff198755bd38202ac9139275b657968b0.
This commit is contained in:
gnoff
2023-11-15 20:58:18 +00:00
parent f870d46a82
commit 438f4b9826
7 changed files with 9 additions and 9 deletions
@@ -25474,7 +25474,7 @@ if (__DEV__) {
return root;
}
var ReactVersion = "18.3.0-canary-aec521a96-20231114";
var ReactVersion = "18.3.0-canary-ee68446ff-20231115";
// Might add PROFILE later.
@@ -9083,7 +9083,7 @@ var devToolsConfig$jscomp$inline_1033 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-aec521a96-20231114",
version: "18.3.0-canary-ee68446ff-20231115",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1226 = {
@@ -9114,7 +9114,7 @@ var internals$jscomp$inline_1226 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-aec521a96-20231114"
reconcilerVersion: "18.3.0-canary-ee68446ff-20231115"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9509,7 +9509,7 @@ var devToolsConfig$jscomp$inline_1075 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-aec521a96-20231114",
version: "18.3.0-canary-ee68446ff-20231115",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1267 = {
@@ -9540,7 +9540,7 @@ var internals$jscomp$inline_1267 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-aec521a96-20231114"
reconcilerVersion: "18.3.0-canary-ee68446ff-20231115"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -24,7 +24,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-canary-aec521a96-20231114";
var ReactVersion = "18.3.0-canary-ee68446ff-20231115";
// ATTENTION
// When adding new symbols to this file,
@@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-aec521a96-20231114";
exports.version = "18.3.0-canary-ee68446ff-20231115";
@@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-aec521a96-20231114";
exports.version = "18.3.0-canary-ee68446ff-20231115";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
@@ -1 +1 @@
aec521a96d3f1bebc2ba38553d14f4989c6e88e0
ee68446ff198755bd38202ac9139275b657968b0