diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 7296966b9f..3c9ee4b7d1 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -0ba4698c7b178161ca8d9dded49d69a53ba3497a +9d111ffdfbcfee4b348a3d49c16f02cb718c896f diff --git a/compiled/facebook-www/REVISION_TRANSFORMS b/compiled/facebook-www/REVISION_TRANSFORMS index 7296966b9f..3c9ee4b7d1 100644 --- a/compiled/facebook-www/REVISION_TRANSFORMS +++ b/compiled/facebook-www/REVISION_TRANSFORMS @@ -1 +1 @@ -0ba4698c7b178161ca8d9dded49d69a53ba3497a +9d111ffdfbcfee4b348a3d49c16f02cb718c896f diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 4272a6fff2..41ab69a11a 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-classic-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 30826ed40d..f65f91e50d 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index 6edc677a1f..070a5db779 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -646,4 +646,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-0ba4698c7-20230201"; +exports.version = "18.3.0-www-classic-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index ac280a1059..ffb26c4607 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -638,4 +638,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-0ba4698c7-20230201"; +exports.version = "18.3.0-www-modern-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index 6243b64098..f133a3fd87 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -657,7 +657,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-0ba4698c7-20230201"; +exports.version = "18.3.0-www-classic-9d111ffdf-20230201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index a9c4fa1a09..fb38639e2d 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -649,7 +649,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-0ba4698c7-20230201"; +exports.version = "18.3.0-www-modern-9d111ffdf-20230201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 126a925962..db3b5b5525 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-classic-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -7192,8 +7192,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop, noop); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -7211,18 +7217,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 382be2ddd9..5c40488694 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -6954,8 +6954,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop, noop); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -6973,18 +6979,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 619ee15892..ae821ab5f8 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -2194,9 +2194,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -2213,14 +2213,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -9846,7 +9845,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-classic-0ba4698c7-20230201", + version: "18.3.0-www-classic-9d111ffdf-20230201", rendererPackageName: "react-art" }; var internals$jscomp$inline_1318 = { @@ -9877,7 +9876,7 @@ var internals$jscomp$inline_1318 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1319 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index f99f2188a3..c6641d3463 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -2000,9 +2000,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop, noop) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -2019,14 +2019,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -9511,7 +9510,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-modern-0ba4698c7-20230201", + version: "18.3.0-www-modern-9d111ffdf-20230201", rendererPackageName: "react-art" }; var internals$jscomp$inline_1309 = { @@ -9542,7 +9541,7 @@ var internals$jscomp$inline_1309 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1310 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 51d212ba8e..79649bb648 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -21457,8 +21457,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop$1, noop$1); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -21476,18 +21482,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // @@ -42689,7 +42695,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 52de9a7213..20c06af6b5 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -21254,8 +21254,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop$1, noop$1); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -21273,18 +21279,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // @@ -42413,7 +42419,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 6298756b4a..6281a65a94 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -6790,9 +6790,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -6809,14 +6809,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -15577,7 +15576,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1750 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-0ba4698c7-20230201", + version: "18.3.0-www-classic-9d111ffdf-20230201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2134 = { @@ -15607,7 +15606,7 @@ var internals$jscomp$inline_2134 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2135 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15855,4 +15854,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-0ba4698c7-20230201"; +exports.version = "18.3.0-next-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 704c4aead8..06e55698c5 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -6641,9 +6641,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -6660,14 +6660,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -15137,7 +15136,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1718 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-0ba4698c7-20230201", + version: "18.3.0-www-modern-9d111ffdf-20230201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2109 = { @@ -15168,7 +15167,7 @@ var internals$jscomp$inline_2109 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2110 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15356,4 +15355,4 @@ exports.unstable_flushControlled = function (fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-0ba4698c7-20230201"; +exports.version = "18.3.0-next-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 4e5a88e92d..940e203f2e 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -6938,9 +6938,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -6957,14 +6957,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -16347,7 +16346,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1824 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-0ba4698c7-20230201", + version: "18.3.0-www-classic-9d111ffdf-20230201", rendererPackageName: "react-dom" }; (function (internals) { @@ -16391,7 +16390,7 @@ var devToolsConfig$jscomp$inline_1824 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16626,7 +16625,7 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-0ba4698c7-20230201"; +exports.version = "18.3.0-next-9d111ffdf-20230201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index bb72a18616..369f749fa6 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -6785,9 +6785,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -6804,14 +6804,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -15897,7 +15896,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1792 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-0ba4698c7-20230201", + version: "18.3.0-www-modern-9d111ffdf-20230201", rendererPackageName: "react-dom" }; (function (internals) { @@ -15942,7 +15941,7 @@ var devToolsConfig$jscomp$inline_1792 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -16117,7 +16116,7 @@ exports.unstable_flushControlled = function (fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-0ba4698c7-20230201"; +exports.version = "18.3.0-next-9d111ffdf-20230201"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 05a9b4d072..1395e061a1 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-classic-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index 9c19ca426f..214d8f47ad 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-modern-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index a11161a230..33486f46d1 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -3634,4 +3634,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-0ba4698c7-20230201"; +exports.version = "18.3.0-www-classic-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 1cc2fde4b4..0817643f6b 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -3548,4 +3548,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-0ba4698c7-20230201"; +exports.version = "18.3.0-www-modern-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index c8aa341d58..aafe8b6ce2 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -12770,8 +12770,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop$1, noop$1); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -12789,18 +12795,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // @@ -31206,7 +31212,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index c7f1185fcf..8151351dea 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -20259,8 +20259,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop$1, noop$1); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -20278,18 +20284,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // @@ -38508,7 +38514,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 5de11facfe..0724868f14 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -3493,9 +3493,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -3512,14 +3512,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -11374,7 +11373,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1518 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-0ba4698c7-20230201", + version: "18.3.0-www-classic-9d111ffdf-20230201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2047 = { @@ -11404,7 +11403,7 @@ var internals$jscomp$inline_2047 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2048 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -14905,4 +14904,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-0ba4698c7-20230201"; +exports.version = "18.3.0-next-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 17419955e8..30a5ecd053 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -6497,9 +6497,9 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": throw thenable.reason; default: - if ("string" !== typeof thenable.status) - switch ( - ((thenableState = thenable), + "string" === typeof thenable.status + ? thenable.then(noop$1, noop$1) + : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then( function (fulfilledValue) { @@ -6516,14 +6516,13 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ), - thenable.status) - ) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; - } + )); + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw thenable.reason; + } suspendedThenable = thenable; throw SuspenseException; } @@ -14008,7 +14007,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1673 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-0ba4698c7-20230201", + version: "18.3.0-www-modern-9d111ffdf-20230201", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2072 = { @@ -14039,7 +14038,7 @@ var internals$jscomp$inline_2072 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-0ba4698c7-20230201" + reconcilerVersion: "18.3.0-next-9d111ffdf-20230201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2073 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -14370,4 +14369,4 @@ exports.unstable_flushControlled = function (fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-0ba4698c7-20230201"; +exports.version = "18.3.0-next-9d111ffdf-20230201"; diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js b/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js index a9e789e1c7..cc54725d63 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js +++ b/compiled/facebook-www/ReactFlightDOMRelayClient-dev.classic.js @@ -488,6 +488,15 @@ function parseModelString(response, parentObject, key, value) { return createLazyChunkWrapper(chunk); } + case "@": { + // Promise + var _id = parseInt(value.substring(2), 16); + + var _chunk = getChunk(response, _id); + + return _chunk; + } + case "S": { return Symbol.for(value.substring(2)); } @@ -498,29 +507,29 @@ function parseModelString(response, parentObject, key, value) { default: { // We assume that anything else is a reference ID. - var _id = parseInt(value.substring(1), 16); + var _id2 = parseInt(value.substring(1), 16); - var _chunk = getChunk(response, _id); + var _chunk2 = getChunk(response, _id2); - switch (_chunk.status) { + switch (_chunk2.status) { case RESOLVED_MODEL: - initializeModelChunk(_chunk); + initializeModelChunk(_chunk2); break; case RESOLVED_MODULE: - initializeModuleChunk(_chunk); + initializeModuleChunk(_chunk2); break; } // The status might have changed after initialization. - switch (_chunk.status) { + switch (_chunk2.status) { case INITIALIZED: - return _chunk.value; + return _chunk2.value; case PENDING: case BLOCKED: var parentChunk = initializingChunk; - _chunk.then( + _chunk2.then( createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk) ); @@ -528,7 +537,7 @@ function parseModelString(response, parentObject, key, value) { return null; default: - throw _chunk.reason; + throw _chunk2.reason; } } } diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js b/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js index a9e789e1c7..cc54725d63 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js +++ b/compiled/facebook-www/ReactFlightDOMRelayClient-dev.modern.js @@ -488,6 +488,15 @@ function parseModelString(response, parentObject, key, value) { return createLazyChunkWrapper(chunk); } + case "@": { + // Promise + var _id = parseInt(value.substring(2), 16); + + var _chunk = getChunk(response, _id); + + return _chunk; + } + case "S": { return Symbol.for(value.substring(2)); } @@ -498,29 +507,29 @@ function parseModelString(response, parentObject, key, value) { default: { // We assume that anything else is a reference ID. - var _id = parseInt(value.substring(1), 16); + var _id2 = parseInt(value.substring(1), 16); - var _chunk = getChunk(response, _id); + var _chunk2 = getChunk(response, _id2); - switch (_chunk.status) { + switch (_chunk2.status) { case RESOLVED_MODEL: - initializeModelChunk(_chunk); + initializeModelChunk(_chunk2); break; case RESOLVED_MODULE: - initializeModuleChunk(_chunk); + initializeModuleChunk(_chunk2); break; } // The status might have changed after initialization. - switch (_chunk.status) { + switch (_chunk2.status) { case INITIALIZED: - return _chunk.value; + return _chunk2.value; case PENDING: case BLOCKED: var parentChunk = initializingChunk; - _chunk.then( + _chunk2.then( createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk) ); @@ -528,7 +537,7 @@ function parseModelString(response, parentObject, key, value) { return null; default: - throw _chunk.reason; + throw _chunk2.reason; } } } diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js b/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js index c35be1902f..a50befba87 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js +++ b/compiled/facebook-www/ReactFlightDOMRelayClient-prod.classic.js @@ -235,24 +235,25 @@ function parseModelString(response, parentObject, key, value) { case "L": return ( (parentObject = parseInt(value.substring(2), 16)), - (parentObject = getChunk(response, parentObject)), - { - $$typeof: REACT_LAZY_TYPE, - _payload: parentObject, - _init: readChunk - } + (response = getChunk(response, parentObject)), + { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + ); + case "@": + return ( + (parentObject = parseInt(value.substring(2), 16)), + getChunk(response, parentObject) ); case "S": return Symbol.for(value.substring(2)); case "P": return ( - (parentObject = value.substring(2)), - ContextRegistry[parentObject] || - (ContextRegistry[parentObject] = React.createServerContext( - parentObject, + (response = value.substring(2)), + ContextRegistry[response] || + (ContextRegistry[response] = React.createServerContext( + response, REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED )), - ContextRegistry[parentObject].Provider + ContextRegistry[response].Provider ); default: value = parseInt(value.substring(1), 16); diff --git a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js b/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js index c35be1902f..a50befba87 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js +++ b/compiled/facebook-www/ReactFlightDOMRelayClient-prod.modern.js @@ -235,24 +235,25 @@ function parseModelString(response, parentObject, key, value) { case "L": return ( (parentObject = parseInt(value.substring(2), 16)), - (parentObject = getChunk(response, parentObject)), - { - $$typeof: REACT_LAZY_TYPE, - _payload: parentObject, - _init: readChunk - } + (response = getChunk(response, parentObject)), + { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + ); + case "@": + return ( + (parentObject = parseInt(value.substring(2), 16)), + getChunk(response, parentObject) ); case "S": return Symbol.for(value.substring(2)); case "P": return ( - (parentObject = value.substring(2)), - ContextRegistry[parentObject] || - (ContextRegistry[parentObject] = React.createServerContext( - parentObject, + (response = value.substring(2)), + ContextRegistry[response] || + (ContextRegistry[response] = React.createServerContext( + response, REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED )), - ContextRegistry[parentObject].Provider + ContextRegistry[response].Provider ); default: value = parseInt(value.substring(1), 16); diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js b/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js index 07927ebcf4..b16b5bb655 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js +++ b/compiled/facebook-www/ReactFlightDOMRelayServer-dev.classic.js @@ -1317,6 +1317,89 @@ var POP = {}; // Used for DEV messages to keep track of which parent rendered so var jsxPropsParents = new WeakMap(); var jsxChildrenParents = new WeakMap(); +function serializeThenable(request, thenable) { + request.pendingChunks++; + var newTask = createTask( + request, + null, + getActiveContext(), + request.abortableTasks + ); + + switch (thenable.status) { + case "fulfilled": { + // We have the resolved value, we can go ahead and schedule it for serialization. + newTask.model = thenable.value; + pingTask(request, newTask); + return newTask.id; + } + + case "rejected": { + var x = thenable.reason; + var digest = logRecoverableError(request, x); + + { + var _getErrorMessageAndSt = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt.message, + stack = _getErrorMessageAndSt.stack; + + emitErrorChunkDev(request, newTask.id, digest, message, stack); + } + + return newTask.id; + } + + default: { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + break; + } + + var pendingThenable = thenable; + pendingThenable.status = "pending"; + pendingThenable.then( + function (fulfilledValue) { + if (thenable.status === "pending") { + var fulfilledThenable = thenable; + fulfilledThenable.status = "fulfilled"; + fulfilledThenable.value = fulfilledValue; + } + }, + function (error) { + if (thenable.status === "pending") { + var rejectedThenable = thenable; + rejectedThenable.status = "rejected"; + rejectedThenable.reason = error; + } + } + ); + break; + } + } + + thenable.then( + function (value) { + newTask.model = value; + pingTask(request, newTask); + }, + function (reason) { + // TODO: Is it safe to directly emit these without being inside a retry? + var digest = logRecoverableError(request, reason); + + { + var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(reason), + _message = _getErrorMessageAndSt2.message, + _stack = _getErrorMessageAndSt2.stack; + + emitErrorChunkDev(request, newTask.id, digest, _message, _stack); + } + } + ); + return newTask.id; +} + function readThenable(thenable) { if (thenable.status === "fulfilled") { return thenable.value; @@ -1375,7 +1458,14 @@ function createLazyWrapperAroundWakeable(wakeable) { return lazyType; } -function attemptResolveElement(type, key, ref, props, prevThenableState) { +function attemptResolveElement( + request, + type, + key, + ref, + props, + prevThenableState +) { if (ref !== null && ref !== undefined) { // When the ref moves to the regular props object this will implicitly // throw for functions. We could probably relax it to a DEV warning for other @@ -1407,6 +1497,15 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { result !== null && typeof result.then === "function" ) { + // When the return value is in children position we can resolve it immediately, + // to its value without a wrapper if it's synchronously available. + var thenable = result; + + if (thenable.status === "fulfilled") { + return thenable.value; + } // TODO: Once we accept Promises as children on the client, we can just return + // the thenable here. + return createLazyWrapperAroundWakeable(result); } @@ -1437,6 +1536,7 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { var init = type._init; var wrappedType = init(payload); return attemptResolveElement( + request, wrappedType, key, ref, @@ -1453,6 +1553,7 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { case REACT_MEMO_TYPE: { return attemptResolveElement( + request, type.type, key, ref, @@ -1531,10 +1632,14 @@ function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeByRefID(id) { +function serializeLazyID(id) { return "$L" + id.toString(16); } +function serializePromiseID(id) { + return "$@" + id.toString(16); +} + function serializeSymbolReference(name) { return "$S" + name; } @@ -1555,7 +1660,7 @@ function serializeClientReference(request, parent, key, moduleReference) { // knows how to deal with lazy values. This lets us suspend // on this component rather than its parent until the code has // loaded. - return serializeByRefID(existingId); + return serializeLazyID(existingId); } return serializeByValueID(existingId); @@ -1577,7 +1682,7 @@ function serializeClientReference(request, parent, key, moduleReference) { // knows how to deal with lazy values. This lets us suspend // on this component rather than its parent until the code has // loaded. - return serializeByRefID(moduleId); + return serializeLazyID(moduleId); } return serializeByValueID(moduleId); @@ -1587,9 +1692,9 @@ function serializeClientReference(request, parent, key, moduleReference) { var digest = logRecoverableError(request, x); { - var _getErrorMessageAndSt = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt.message, - stack = _getErrorMessageAndSt.stack; + var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt3.message, + stack = _getErrorMessageAndSt3.stack; emitErrorChunkDev(request, errorId, digest, message, stack); } @@ -1998,6 +2103,7 @@ function resolveModelToJSON(request, parent, key, value) { var element = value; // Attempt to render the Server Component. value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -2036,7 +2142,7 @@ function resolveModelToJSON(request, parent, key, value) { var ping = newTask.ping; x.then(ping, ping); newTask.thenableState = getThenableStateAfterSuspending(); - return serializeByRefID(newTask.id); + return serializeLazyID(newTask.id); } else { // Something errored. We'll still send everything we have up until this point. // We'll replace this element with a lazy reference that throws on the client @@ -2046,14 +2152,14 @@ function resolveModelToJSON(request, parent, key, value) { var digest = logRecoverableError(request, x); { - var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt2.message, - stack = _getErrorMessageAndSt2.stack; + var _getErrorMessageAndSt4 = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt4.message, + stack = _getErrorMessageAndSt4.stack; emitErrorChunkDev(request, errorId, digest, message, stack); } - return serializeByRefID(errorId); + return serializeLazyID(errorId); } } } @@ -2065,6 +2171,11 @@ function resolveModelToJSON(request, parent, key, value) { if (typeof value === "object") { if (isClientReference(value)) { return serializeClientReference(request, parent, key, value); + } else if (typeof value.then === "function") { + // We assume that any object with a .then property is a "Thenable" type, + // or a Promise type. Either of which can be represented by a Promise. + var promiseId = serializeThenable(request, value); + return serializePromiseID(promiseId); } else if (value.$$typeof === REACT_PROVIDER_TYPE) { var providerKey = value._context._globalName; var writtenProviders = request.writtenProviders; @@ -2305,6 +2416,7 @@ function retryTask(request, task) { task.model = value; value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -2326,6 +2438,7 @@ function retryTask(request, task) { var nextElement = value; task.model = value; value = attemptResolveElement( + request, nextElement.type, nextElement.key, nextElement.ref, @@ -2361,9 +2474,9 @@ function retryTask(request, task) { var digest = logRecoverableError(request, x); { - var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt3.message, - stack = _getErrorMessageAndSt3.stack; + var _getErrorMessageAndSt5 = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt5.message, + stack = _getErrorMessageAndSt5.stack; emitErrorChunkDev(request, task.id, digest, message, stack); } diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js b/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js index 948fbf0009..21f73c1e2d 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js +++ b/compiled/facebook-www/ReactFlightDOMRelayServer-dev.modern.js @@ -1321,6 +1321,89 @@ var POP = {}; // Used for DEV messages to keep track of which parent rendered so var jsxPropsParents = new WeakMap(); var jsxChildrenParents = new WeakMap(); +function serializeThenable(request, thenable) { + request.pendingChunks++; + var newTask = createTask( + request, + null, + getActiveContext(), + request.abortableTasks + ); + + switch (thenable.status) { + case "fulfilled": { + // We have the resolved value, we can go ahead and schedule it for serialization. + newTask.model = thenable.value; + pingTask(request, newTask); + return newTask.id; + } + + case "rejected": { + var x = thenable.reason; + var digest = logRecoverableError(request, x); + + { + var _getErrorMessageAndSt = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt.message, + stack = _getErrorMessageAndSt.stack; + + emitErrorChunkDev(request, newTask.id, digest, message, stack); + } + + return newTask.id; + } + + default: { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + break; + } + + var pendingThenable = thenable; + pendingThenable.status = "pending"; + pendingThenable.then( + function (fulfilledValue) { + if (thenable.status === "pending") { + var fulfilledThenable = thenable; + fulfilledThenable.status = "fulfilled"; + fulfilledThenable.value = fulfilledValue; + } + }, + function (error) { + if (thenable.status === "pending") { + var rejectedThenable = thenable; + rejectedThenable.status = "rejected"; + rejectedThenable.reason = error; + } + } + ); + break; + } + } + + thenable.then( + function (value) { + newTask.model = value; + pingTask(request, newTask); + }, + function (reason) { + // TODO: Is it safe to directly emit these without being inside a retry? + var digest = logRecoverableError(request, reason); + + { + var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(reason), + _message = _getErrorMessageAndSt2.message, + _stack = _getErrorMessageAndSt2.stack; + + emitErrorChunkDev(request, newTask.id, digest, _message, _stack); + } + } + ); + return newTask.id; +} + function readThenable(thenable) { if (thenable.status === "fulfilled") { return thenable.value; @@ -1379,7 +1462,14 @@ function createLazyWrapperAroundWakeable(wakeable) { return lazyType; } -function attemptResolveElement(type, key, ref, props, prevThenableState) { +function attemptResolveElement( + request, + type, + key, + ref, + props, + prevThenableState +) { if (ref !== null && ref !== undefined) { // When the ref moves to the regular props object this will implicitly // throw for functions. We could probably relax it to a DEV warning for other @@ -1411,6 +1501,15 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { result !== null && typeof result.then === "function" ) { + // When the return value is in children position we can resolve it immediately, + // to its value without a wrapper if it's synchronously available. + var thenable = result; + + if (thenable.status === "fulfilled") { + return thenable.value; + } // TODO: Once we accept Promises as children on the client, we can just return + // the thenable here. + return createLazyWrapperAroundWakeable(result); } @@ -1441,6 +1540,7 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { var init = type._init; var wrappedType = init(payload); return attemptResolveElement( + request, wrappedType, key, ref, @@ -1457,6 +1557,7 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { case REACT_MEMO_TYPE: { return attemptResolveElement( + request, type.type, key, ref, @@ -1535,10 +1636,14 @@ function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeByRefID(id) { +function serializeLazyID(id) { return "$L" + id.toString(16); } +function serializePromiseID(id) { + return "$@" + id.toString(16); +} + function serializeSymbolReference(name) { return "$S" + name; } @@ -1559,7 +1664,7 @@ function serializeClientReference(request, parent, key, moduleReference) { // knows how to deal with lazy values. This lets us suspend // on this component rather than its parent until the code has // loaded. - return serializeByRefID(existingId); + return serializeLazyID(existingId); } return serializeByValueID(existingId); @@ -1581,7 +1686,7 @@ function serializeClientReference(request, parent, key, moduleReference) { // knows how to deal with lazy values. This lets us suspend // on this component rather than its parent until the code has // loaded. - return serializeByRefID(moduleId); + return serializeLazyID(moduleId); } return serializeByValueID(moduleId); @@ -1591,9 +1696,9 @@ function serializeClientReference(request, parent, key, moduleReference) { var digest = logRecoverableError(request, x); { - var _getErrorMessageAndSt = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt.message, - stack = _getErrorMessageAndSt.stack; + var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt3.message, + stack = _getErrorMessageAndSt3.stack; emitErrorChunkDev(request, errorId, digest, message, stack); } @@ -2002,6 +2107,7 @@ function resolveModelToJSON(request, parent, key, value) { var element = value; // Attempt to render the Server Component. value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -2040,7 +2146,7 @@ function resolveModelToJSON(request, parent, key, value) { var ping = newTask.ping; x.then(ping, ping); newTask.thenableState = getThenableStateAfterSuspending(); - return serializeByRefID(newTask.id); + return serializeLazyID(newTask.id); } else { // Something errored. We'll still send everything we have up until this point. // We'll replace this element with a lazy reference that throws on the client @@ -2050,14 +2156,14 @@ function resolveModelToJSON(request, parent, key, value) { var digest = logRecoverableError(request, x); { - var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt2.message, - stack = _getErrorMessageAndSt2.stack; + var _getErrorMessageAndSt4 = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt4.message, + stack = _getErrorMessageAndSt4.stack; emitErrorChunkDev(request, errorId, digest, message, stack); } - return serializeByRefID(errorId); + return serializeLazyID(errorId); } } } @@ -2069,6 +2175,11 @@ function resolveModelToJSON(request, parent, key, value) { if (typeof value === "object") { if (isClientReference(value)) { return serializeClientReference(request, parent, key, value); + } else if (typeof value.then === "function") { + // We assume that any object with a .then property is a "Thenable" type, + // or a Promise type. Either of which can be represented by a Promise. + var promiseId = serializeThenable(request, value); + return serializePromiseID(promiseId); } else if (value.$$typeof === REACT_PROVIDER_TYPE) { var providerKey = value._context._globalName; var writtenProviders = request.writtenProviders; @@ -2309,6 +2420,7 @@ function retryTask(request, task) { task.model = value; value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -2330,6 +2442,7 @@ function retryTask(request, task) { var nextElement = value; task.model = value; value = attemptResolveElement( + request, nextElement.type, nextElement.key, nextElement.ref, @@ -2365,9 +2478,9 @@ function retryTask(request, task) { var digest = logRecoverableError(request, x); { - var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x), - message = _getErrorMessageAndSt3.message, - stack = _getErrorMessageAndSt3.stack; + var _getErrorMessageAndSt5 = getErrorMessageAndStackDev(x), + message = _getErrorMessageAndSt5.message, + stack = _getErrorMessageAndSt5.stack; emitErrorChunkDev(request, task.id, digest, message, stack); } diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js b/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js index c82415509e..ded0b1a2d5 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js +++ b/compiled/facebook-www/ReactFlightDOMRelayServer-prod.classic.js @@ -521,6 +521,50 @@ function createRequest( return request; } var POP = {}; +function serializeThenable(request, thenable) { + request.pendingChunks++; + var newTask = createTask( + request, + null, + currentActiveSnapshot, + request.abortableTasks + ); + switch (thenable.status) { + case "fulfilled": + return ( + (newTask.model = thenable.value), pingTask(request, newTask), newTask.id + ); + case "rejected": + var digest = logRecoverableError(request, thenable.reason); + emitErrorChunkProd(request, newTask.id, digest); + return newTask.id; + default: + "string" !== typeof thenable.status && + ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + )); + } + thenable.then( + function (value) { + newTask.model = value; + pingTask(request, newTask); + }, + function (reason) { + reason = logRecoverableError(request, reason); + emitErrorChunkProd(request, newTask.id, reason); + } + ); + return newTask.id; +} function readThenable(thenable) { if ("fulfilled" === thenable.status) return thenable.value; if ("rejected" === thenable.status) throw thenable.reason; @@ -548,7 +592,14 @@ function createLazyWrapperAroundWakeable(wakeable) { } return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } -function attemptResolveElement(type, key, ref, props, prevThenableState) { +function attemptResolveElement( + request, + type, + key, + ref, + props, + prevThenableState +) { if (null !== ref && void 0 !== ref) throw Error( "Refs cannot be used in Server Components, nor passed to Client Components." @@ -562,7 +613,9 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { return "object" === typeof props && null !== props && "function" === typeof props.then - ? createLazyWrapperAroundWakeable(props) + ? "fulfilled" === props.status + ? props.value + : createLazyWrapperAroundWakeable(props) : props; } if ("string" === typeof type) return [REACT_ELEMENT_TYPE, type, key, props]; @@ -577,16 +630,24 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { case REACT_LAZY_TYPE: var init = type._init; type = init(type._payload); - return attemptResolveElement(type, key, ref, props, prevThenableState); + return attemptResolveElement( + request, + type, + key, + ref, + props, + prevThenableState + ); case REACT_FORWARD_REF_TYPE: return ( - (key = type.render), + (request = type.render), (thenableIndexCounter = 0), (thenableState = prevThenableState), - key(props, void 0) + request(props, void 0) ); case REACT_MEMO_TYPE: return attemptResolveElement( + request, type.type, key, ref, @@ -609,6 +670,11 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { "Unsupported Server Component type: " + describeValueForErrorMessage(type) ); } +function pingTask(request, task) { + var pingedTasks = request.pingedTasks; + pingedTasks.push(task); + 1 === pingedTasks.length && performWork(request); +} function createTask(request, model, context, abortSet) { var task = { id: request.nextChunkId++, @@ -616,9 +682,7 @@ function createTask(request, model, context, abortSet) { model: model, context: context, ping: function () { - var pingedTasks = request.pingedTasks; - pingedTasks.push(task); - 1 === pingedTasks.length && performWork(request); + return pingTask(request, task); }, thenableState: null }; @@ -774,6 +838,7 @@ function resolveModelToJSON(request, parent, key, value) { case REACT_ELEMENT_TYPE: var element = value; value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -818,6 +883,8 @@ function resolveModelToJSON(request, parent, key, value) { if ("object" === typeof value) { if (value instanceof JSResourceReferenceImpl) return serializeClientReference(request, parent, key, value); + if ("function" === typeof value.then) + return "$@" + serializeThenable(request, value).toString(16); if (value.$$typeof === REACT_PROVIDER_TYPE) return ( (value = value._context._globalName), @@ -944,6 +1011,7 @@ function performWork(request$jscomp$0) { prevThenableState = task.thenableState; task.model = value; value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -960,6 +1028,7 @@ function performWork(request$jscomp$0) { (element = value), (task.model = value), (value = attemptResolveElement( + request, element.type, element.key, element.ref, diff --git a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js b/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js index 7f794ac957..146242a301 100644 --- a/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js +++ b/compiled/facebook-www/ReactFlightDOMRelayServer-prod.modern.js @@ -524,6 +524,50 @@ function createRequest( return request; } var POP = {}; +function serializeThenable(request, thenable) { + request.pendingChunks++; + var newTask = createTask( + request, + null, + currentActiveSnapshot, + request.abortableTasks + ); + switch (thenable.status) { + case "fulfilled": + return ( + (newTask.model = thenable.value), pingTask(request, newTask), newTask.id + ); + case "rejected": + var digest = logRecoverableError(request, thenable.reason); + emitErrorChunkProd(request, newTask.id, digest); + return newTask.id; + default: + "string" !== typeof thenable.status && + ((thenable.status = "pending"), + thenable.then( + function (fulfilledValue) { + "pending" === thenable.status && + ((thenable.status = "fulfilled"), + (thenable.value = fulfilledValue)); + }, + function (error) { + "pending" === thenable.status && + ((thenable.status = "rejected"), (thenable.reason = error)); + } + )); + } + thenable.then( + function (value) { + newTask.model = value; + pingTask(request, newTask); + }, + function (reason) { + reason = logRecoverableError(request, reason); + emitErrorChunkProd(request, newTask.id, reason); + } + ); + return newTask.id; +} function readThenable(thenable) { if ("fulfilled" === thenable.status) return thenable.value; if ("rejected" === thenable.status) throw thenable.reason; @@ -551,7 +595,14 @@ function createLazyWrapperAroundWakeable(wakeable) { } return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } -function attemptResolveElement(type, key, ref, props, prevThenableState) { +function attemptResolveElement( + request, + type, + key, + ref, + props, + prevThenableState +) { if (null !== ref && void 0 !== ref) throw Error( "Refs cannot be used in Server Components, nor passed to Client Components." @@ -565,7 +616,9 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { return "object" === typeof props && null !== props && "function" === typeof props.then - ? createLazyWrapperAroundWakeable(props) + ? "fulfilled" === props.status + ? props.value + : createLazyWrapperAroundWakeable(props) : props; } if ("string" === typeof type) return [REACT_ELEMENT_TYPE, type, key, props]; @@ -580,16 +633,24 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { case REACT_LAZY_TYPE: var init = type._init; type = init(type._payload); - return attemptResolveElement(type, key, ref, props, prevThenableState); + return attemptResolveElement( + request, + type, + key, + ref, + props, + prevThenableState + ); case REACT_FORWARD_REF_TYPE: return ( - (key = type.render), + (request = type.render), (thenableIndexCounter = 0), (thenableState = prevThenableState), - key(props, void 0) + request(props, void 0) ); case REACT_MEMO_TYPE: return attemptResolveElement( + request, type.type, key, ref, @@ -612,6 +673,11 @@ function attemptResolveElement(type, key, ref, props, prevThenableState) { "Unsupported Server Component type: " + describeValueForErrorMessage(type) ); } +function pingTask(request, task) { + var pingedTasks = request.pingedTasks; + pingedTasks.push(task); + 1 === pingedTasks.length && performWork(request); +} function createTask(request, model, context, abortSet) { var task = { id: request.nextChunkId++, @@ -619,9 +685,7 @@ function createTask(request, model, context, abortSet) { model: model, context: context, ping: function () { - var pingedTasks = request.pingedTasks; - pingedTasks.push(task); - 1 === pingedTasks.length && performWork(request); + return pingTask(request, task); }, thenableState: null }; @@ -777,6 +841,7 @@ function resolveModelToJSON(request, parent, key, value) { case REACT_ELEMENT_TYPE: var element = value; value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -821,6 +886,8 @@ function resolveModelToJSON(request, parent, key, value) { if ("object" === typeof value) { if (value instanceof JSResourceReferenceImpl) return serializeClientReference(request, parent, key, value); + if ("function" === typeof value.then) + return "$@" + serializeThenable(request, value).toString(16); if (value.$$typeof === REACT_PROVIDER_TYPE) return ( (value = value._context._globalName), @@ -947,6 +1014,7 @@ function performWork(request$jscomp$0) { prevThenableState = task.thenableState; task.model = value; value = attemptResolveElement( + request, element.type, element.key, element.ref, @@ -963,6 +1031,7 @@ function performWork(request$jscomp$0) { (element = value), (task.model = value), (value = attemptResolveElement( + request, element.type, element.key, element.ref, diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 919e87f344..a2a6683d1b 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -6159,8 +6159,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop, noop); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -6178,18 +6184,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // @@ -23905,7 +23911,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 56d88c40c2..a47958c152 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -6159,8 +6159,14 @@ function trackUsedThenable(thenableState, thenable, index) { } default: { - if (typeof thenable.status === "string"); - else { + if (typeof thenable.status === "string") { + // Only instrument the thenable if the status if not defined. If + // it's defined, but an unknown value, assume it's been instrumented by + // some custom userspace implementation. We treat it as "pending". + // Attach a dummy listener, to ensure that any lazy initialization can + // happen. Flight lazily parses JSON when the value is actually awaited. + thenable.then(noop, noop); + } else { var pendingThenable = thenable; pendingThenable.status = "pending"; pendingThenable.then( @@ -6178,18 +6184,18 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); // Check one more time in case the thenable resolved synchronously + ); + } // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; - } + case "rejected": { + var rejectedThenable = thenable; + throw rejectedThenable.reason; } } // Suspend. // @@ -23905,7 +23911,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-0ba4698c7-20230201"; +var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201"; // Might add PROFILE later.