mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Serialize Promises through Flight (#26086)
This lets you pass Promises from server components to client components
and `use()` them there.
We still don't support Promises as children on the client, so we need to
support both. This will be a lot simpler when we remove the need to
encode children as lazy since we don't need the lazy encoding anymore
then.
I noticed that this test failed because we don't synchronously resolve
instrumented Promises if they're lazy. The second fix calls `.then()`
early to ensure that this lazy initialization can happen eagerly. ~It
felt silly to do this with an empty function or something, so I just did
the attachment of ping listeners early here. It's also a little silly
since they will ping the currently running render for no reason if it's
synchronously available.~ EDIT: That didn't work because a ping might
interrupt the current render. Probably need a bigger refactor.
We could add another extension but we've already taken a lot of
liberties with the Promise protocol. At least this is one that doesn't
need extension of the protocol as much. Any sub-class of promises could
do this.
DiffTrain build for [9d111ffdfb](https://github.com/facebook/react/commit/9d111ffdfbcfee4b348a3d49c16f02cb718c896f)
[View git log for this commit](https://github.com/facebook/react/commits/9d111ffdfbcfee4b348a3d49c16f02cb718c896f)
This commit is contained in:
@@ -1 +1 @@
|
||||
0ba4698c7b178161ca8d9dded49d69a53ba3497a
|
||||
9d111ffdfbcfee4b348a3d49c16f02cb718c896f
|
||||
|
||||
@@ -1 +1 @@
|
||||
0ba4698c7b178161ca8d9dded49d69a53ba3497a
|
||||
9d111ffdfbcfee4b348a3d49c16f02cb718c896f
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
|
||||
@@ -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__;
|
||||
|
||||
@@ -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__;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user