mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Suspend Thenable/Lazy if it's used in React.Children and unwrap (#28284)
This pains me because `React.Children` is really already pseudo-deprecated. `React.Children` takes any children that `React.Node` takes. We now support Lazy and Thenable in this position elsewhere, but it errors in `React.Children`. This becomes an issue with async Server Components which can resolve into a Lazy and in the future Lazy will just become Thenables. Which causes this to error. There are a few different semantics we could have: 1) Error like we already do (#28280). `React.Children` is about introspecting children. It was always sketchy because you can't introspect inside an abstraction anyway. With Server Components we fold away the components so you can actually introspect inside of them kind of but what they do is an implementation detail and you should be able to turn it into a Client Component at any point. The type of an Element passing the boundary actually reduces to `React.Node`. 2) Suspend and unwrap the Node (this PR). If we assume that Children is called inside of render, then throwing a Promise if it's not already loaded or unwrapping would treat it as if it wasn't there. Just like if you rendered it in React. This lets you introspect what's inside which isn't really something you should be able to do. This isn't compatible with deprecating throwing-a-Promise and enable static compilation like `use()` does. We'd have to deprecate `React.Children` before doing that which we might anyway. 3) Wrap in a Fragment. If a Server Component was instead a Client Component, you couldn't introspect through it anyway. Another alternative might be to let it pass through but then it wouldn't be given a flat key. We could also wrap it in a Fragment that is keyed. That way you're always seeing an element. The issue with this solution is that it wouldn't see the key of the Server Component since that gets forwarded to the child that is yet to resolve. The nice thing about that strategy is it doesn't depend on throw-a-Promise but it might not be keyed correctly when things move. DiffTrain build for commit https://github.com/facebook/react/commit/9e7944f67c72b9a69a8db092ba6bd99fe9c731e2.
This commit is contained in:
+14
-14
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<1aed0b993a4c164c11bd44255ec4ddac>>
|
||||
* @generated SignedSource<<9e5c6574214265b8a7f68fb3d0ee99e5>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -5021,20 +5021,20 @@ if (__DEV__) {
|
||||
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;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
checkIfUseWrappedInAsyncCatch(_rejectedError);
|
||||
throw _rejectedError;
|
||||
}
|
||||
case "rejected": {
|
||||
var rejectedThenable = thenable;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
checkIfUseWrappedInAsyncCatch(_rejectedError);
|
||||
throw _rejectedError;
|
||||
}
|
||||
} // Suspend.
|
||||
//
|
||||
@@ -25721,7 +25721,7 @@ if (__DEV__) {
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-629541bcc-20240212";
|
||||
var ReactVersion = "18.3.0-canary-9e7944f67-20240212";
|
||||
|
||||
// Might add PROFILE later.
|
||||
|
||||
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<1fafe8c779f4832b19959f28b49afe3e>>
|
||||
* @generated SignedSource<<6223b3402ebe91d202065e784f2d9af4>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -1402,16 +1402,16 @@ function trackUsedThenable(thenableState, thenable, index) {
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
}
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
suspendedThenable = thenable;
|
||||
throw SuspenseException;
|
||||
@@ -9173,7 +9173,7 @@ var devToolsConfig$jscomp$inline_1023 = {
|
||||
throw Error("TestRenderer does not support findFiberByHostInstance()");
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-629541bcc-20240212",
|
||||
version: "18.3.0-canary-9e7944f67-20240212",
|
||||
rendererPackageName: "react-test-renderer"
|
||||
};
|
||||
var internals$jscomp$inline_1204 = {
|
||||
@@ -9204,7 +9204,7 @@ var internals$jscomp$inline_1204 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-629541bcc-20240212"
|
||||
reconcilerVersion: "18.3.0-canary-9e7944f67-20240212"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1205 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<a0a2d876cbe4fb943cdc49c02ecf6a31>>
|
||||
* @generated SignedSource<<9a90acaf1cc6a5a23ed59dfb8d38c84f>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -1422,16 +1422,16 @@ function trackUsedThenable(thenableState, thenable, index) {
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
}
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
suspendedThenable = thenable;
|
||||
throw SuspenseException;
|
||||
@@ -9601,7 +9601,7 @@ var devToolsConfig$jscomp$inline_1065 = {
|
||||
throw Error("TestRenderer does not support findFiberByHostInstance()");
|
||||
},
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-629541bcc-20240212",
|
||||
version: "18.3.0-canary-9e7944f67-20240212",
|
||||
rendererPackageName: "react-test-renderer"
|
||||
};
|
||||
var internals$jscomp$inline_1245 = {
|
||||
@@ -9632,7 +9632,7 @@ var internals$jscomp$inline_1245 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-629541bcc-20240212"
|
||||
reconcilerVersion: "18.3.0-canary-9e7944f67-20240212"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1246 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+81
-12
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<70ab383eec7c39690b53a887a16d26d0>>
|
||||
* @generated SignedSource<<e3defaed524124e7d1cb2b9785a29b43>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -24,7 +24,7 @@ if (__DEV__) {
|
||||
) {
|
||||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
||||
}
|
||||
var ReactVersion = "18.3.0-canary-629541bcc-20240212";
|
||||
var ReactVersion = "18.3.0-canary-9e7944f67-20240212";
|
||||
|
||||
// ATTENTION
|
||||
// When adding new symbols to this file,
|
||||
@@ -1768,6 +1768,69 @@ if (__DEV__) {
|
||||
return index.toString(36);
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
function resolveThenable(thenable) {
|
||||
switch (thenable.status) {
|
||||
case "fulfilled": {
|
||||
var fulfilledValue = thenable.value;
|
||||
return fulfilledValue;
|
||||
}
|
||||
|
||||
case "rejected": {
|
||||
var rejectedError = thenable.reason;
|
||||
throw rejectedError;
|
||||
}
|
||||
|
||||
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".
|
||||
// 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 {
|
||||
// This is an uncached thenable that we haven't seen before.
|
||||
// TODO: Detect infinite ping loops caused by uncached promises.
|
||||
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;
|
||||
}
|
||||
}
|
||||
);
|
||||
} // Check one more time in case the thenable resolved synchronously.
|
||||
|
||||
switch (thenable.status) {
|
||||
case "fulfilled": {
|
||||
var fulfilledThenable = thenable;
|
||||
return fulfilledThenable.value;
|
||||
}
|
||||
|
||||
case "rejected": {
|
||||
var rejectedThenable = thenable;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
throw _rejectedError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw thenable;
|
||||
}
|
||||
|
||||
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
var type = typeof children;
|
||||
|
||||
@@ -1795,9 +1858,14 @@ if (__DEV__) {
|
||||
break;
|
||||
|
||||
case REACT_LAZY_TYPE:
|
||||
throw new Error(
|
||||
"Cannot render an Async Component, Promise or React.Lazy inside React.Children. " +
|
||||
"We recommend not iterating over children and just rendering them plain."
|
||||
var payload = children._payload;
|
||||
var init = children._init;
|
||||
return mapIntoArray(
|
||||
init(payload),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1910,16 +1978,17 @@ if (__DEV__) {
|
||||
);
|
||||
}
|
||||
} else if (type === "object") {
|
||||
// eslint-disable-next-line react-internal/safe-string-coercion
|
||||
var childrenString = String(children);
|
||||
|
||||
if (typeof children.then === "function") {
|
||||
throw new Error(
|
||||
"Cannot render an Async Component, Promise or React.Lazy inside React.Children. " +
|
||||
"We recommend not iterating over children and just rendering them plain."
|
||||
return mapIntoArray(
|
||||
resolveThenable(children),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
);
|
||||
}
|
||||
} // eslint-disable-next-line react-internal/safe-string-coercion
|
||||
|
||||
var childrenString = String(children);
|
||||
throw new Error(
|
||||
"Objects are not valid as a React child (found: " +
|
||||
(childrenString === "[object Object]"
|
||||
|
||||
+79
-40
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<16d58eb8536d00d4c5865c8269806ef1>>
|
||||
* @generated SignedSource<<08bdb926358682042fe1bad33494956d>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -161,6 +161,39 @@ function getElementKey(element, index) {
|
||||
? escape("" + element.key)
|
||||
: index.toString(36);
|
||||
}
|
||||
function noop() {}
|
||||
function resolveThenable(thenable) {
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
default:
|
||||
switch (
|
||||
("string" === typeof thenable.status
|
||||
? thenable.then(noop, noop)
|
||||
: ((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.status)
|
||||
) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
}
|
||||
}
|
||||
throw thenable;
|
||||
}
|
||||
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
var type = typeof children;
|
||||
if ("undefined" === type || "boolean" === type) children = null;
|
||||
@@ -179,22 +212,28 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
invokeCallback = !0;
|
||||
break;
|
||||
case REACT_LAZY_TYPE:
|
||||
throw Error(
|
||||
"Cannot render an Async Component, Promise or React.Lazy inside React.Children. We recommend not iterating over children and just rendering them plain."
|
||||
return (
|
||||
(invokeCallback = children._init),
|
||||
mapIntoArray(
|
||||
invokeCallback(children._payload),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (invokeCallback)
|
||||
return (
|
||||
(invokeCallback = children),
|
||||
(callback = callback(invokeCallback)),
|
||||
(children =
|
||||
"" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar),
|
||||
(callback = callback(children)),
|
||||
(invokeCallback =
|
||||
"" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
|
||||
isArrayImpl(callback)
|
||||
? ((escapedPrefix = ""),
|
||||
null != children &&
|
||||
null != invokeCallback &&
|
||||
(escapedPrefix =
|
||||
children.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
||||
invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
||||
mapIntoArray(callback, array, escapedPrefix, "", function (c) {
|
||||
return c;
|
||||
}))
|
||||
@@ -203,55 +242,55 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
(callback = cloneAndReplaceKey(
|
||||
callback,
|
||||
escapedPrefix +
|
||||
(!callback.key ||
|
||||
(invokeCallback && invokeCallback.key === callback.key)
|
||||
(!callback.key || (children && children.key === callback.key)
|
||||
? ""
|
||||
: ("" + callback.key).replace(
|
||||
userProvidedKeyEscapeRegex,
|
||||
"$&/"
|
||||
) + "/") +
|
||||
children
|
||||
invokeCallback
|
||||
)),
|
||||
array.push(callback)),
|
||||
1
|
||||
);
|
||||
invokeCallback = 0;
|
||||
nameSoFar = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
if (isArrayImpl(children))
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
type = children[i];
|
||||
var nextName = nameSoFar + getElementKey(type, i);
|
||||
invokeCallback += mapIntoArray(
|
||||
type,
|
||||
array,
|
||||
escapedPrefix,
|
||||
nextName,
|
||||
callback
|
||||
);
|
||||
}
|
||||
else if (
|
||||
((nextName = getIteratorFn(children)), "function" === typeof nextName)
|
||||
)
|
||||
for (
|
||||
children = nextName.call(children), i = 0;
|
||||
!(type = children.next()).done;
|
||||
|
||||
)
|
||||
(type = type.value),
|
||||
(nextName = nameSoFar + getElementKey(type, i++)),
|
||||
for (var i = 0; i < children.length; i++)
|
||||
(nameSoFar = children[i]),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
type,
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
nextName,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if (((i = getIteratorFn(children)), "function" === typeof i))
|
||||
for (
|
||||
children = i.call(children), i = 0;
|
||||
!(nameSoFar = children.next()).done;
|
||||
|
||||
)
|
||||
(nameSoFar = nameSoFar.value),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i++)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if ("object" === type) {
|
||||
array = String(children);
|
||||
if ("function" === typeof children.then)
|
||||
throw Error(
|
||||
"Cannot render an Async Component, Promise or React.Lazy inside React.Children. We recommend not iterating over children and just rendering them plain."
|
||||
return mapIntoArray(
|
||||
resolveThenable(children),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
);
|
||||
array = String(children);
|
||||
throw Error(
|
||||
"Objects are not valid as a React child (found: " +
|
||||
("[object Object]" === array
|
||||
@@ -551,4 +590,4 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactCurrentDispatcher.current.useTransition();
|
||||
};
|
||||
exports.version = "18.3.0-canary-629541bcc-20240212";
|
||||
exports.version = "18.3.0-canary-9e7944f67-20240212";
|
||||
|
||||
+79
-40
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<b8b76608b94e652bed210d7cb704af18>>
|
||||
* @generated SignedSource<<f35a9457ef3a32fa7212af3d759fb90c>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -136,6 +136,39 @@ function getElementKey(element, index) {
|
||||
? escape("" + element.key)
|
||||
: index.toString(36);
|
||||
}
|
||||
function noop() {}
|
||||
function resolveThenable(thenable) {
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
default:
|
||||
switch (
|
||||
("string" === typeof thenable.status
|
||||
? thenable.then(noop, noop)
|
||||
: ((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.status)
|
||||
) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
}
|
||||
}
|
||||
throw thenable;
|
||||
}
|
||||
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
var type = typeof children;
|
||||
if ("undefined" === type || "boolean" === type) children = null;
|
||||
@@ -154,22 +187,28 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
invokeCallback = !0;
|
||||
break;
|
||||
case REACT_LAZY_TYPE:
|
||||
throw Error(
|
||||
"Cannot render an Async Component, Promise or React.Lazy inside React.Children. We recommend not iterating over children and just rendering them plain."
|
||||
return (
|
||||
(invokeCallback = children._init),
|
||||
mapIntoArray(
|
||||
invokeCallback(children._payload),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (invokeCallback)
|
||||
return (
|
||||
(invokeCallback = children),
|
||||
(callback = callback(invokeCallback)),
|
||||
(children =
|
||||
"" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar),
|
||||
(callback = callback(children)),
|
||||
(invokeCallback =
|
||||
"" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
|
||||
isArrayImpl(callback)
|
||||
? ((escapedPrefix = ""),
|
||||
null != children &&
|
||||
null != invokeCallback &&
|
||||
(escapedPrefix =
|
||||
children.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
||||
invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
||||
mapIntoArray(callback, array, escapedPrefix, "", function (c) {
|
||||
return c;
|
||||
}))
|
||||
@@ -178,55 +217,55 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
(callback = cloneAndReplaceKey(
|
||||
callback,
|
||||
escapedPrefix +
|
||||
(!callback.key ||
|
||||
(invokeCallback && invokeCallback.key === callback.key)
|
||||
(!callback.key || (children && children.key === callback.key)
|
||||
? ""
|
||||
: ("" + callback.key).replace(
|
||||
userProvidedKeyEscapeRegex,
|
||||
"$&/"
|
||||
) + "/") +
|
||||
children
|
||||
invokeCallback
|
||||
)),
|
||||
array.push(callback)),
|
||||
1
|
||||
);
|
||||
invokeCallback = 0;
|
||||
nameSoFar = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
if (isArrayImpl(children))
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
type = children[i];
|
||||
var nextName = nameSoFar + getElementKey(type, i);
|
||||
invokeCallback += mapIntoArray(
|
||||
type,
|
||||
array,
|
||||
escapedPrefix,
|
||||
nextName,
|
||||
callback
|
||||
);
|
||||
}
|
||||
else if (
|
||||
((nextName = getIteratorFn(children)), "function" === typeof nextName)
|
||||
)
|
||||
for (
|
||||
children = nextName.call(children), i = 0;
|
||||
!(type = children.next()).done;
|
||||
|
||||
)
|
||||
(type = type.value),
|
||||
(nextName = nameSoFar + getElementKey(type, i++)),
|
||||
for (var i = 0; i < children.length; i++)
|
||||
(nameSoFar = children[i]),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
type,
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
nextName,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if (((i = getIteratorFn(children)), "function" === typeof i))
|
||||
for (
|
||||
children = i.call(children), i = 0;
|
||||
!(nameSoFar = children.next()).done;
|
||||
|
||||
)
|
||||
(nameSoFar = nameSoFar.value),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i++)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if ("object" === type) {
|
||||
array = String(children);
|
||||
if ("function" === typeof children.then)
|
||||
throw Error(
|
||||
"Cannot render an Async Component, Promise or React.Lazy inside React.Children. We recommend not iterating over children and just rendering them plain."
|
||||
return mapIntoArray(
|
||||
resolveThenable(children),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
);
|
||||
array = String(children);
|
||||
throw Error(
|
||||
"Objects are not valid as a React child (found: " +
|
||||
("[object Object]" === array
|
||||
@@ -547,7 +586,7 @@ exports.useSyncExternalStore = function (
|
||||
exports.useTransition = function () {
|
||||
return ReactCurrentDispatcher.current.useTransition();
|
||||
};
|
||||
exports.version = "18.3.0-canary-629541bcc-20240212";
|
||||
exports.version = "18.3.0-canary-9e7944f67-20240212";
|
||||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
||||
"function" ===
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
629541bcc09fc7c0cc5c257541d084ee27457512
|
||||
9e7944f67c72b9a69a8db092ba6bd99fe9c731e2
|
||||
|
||||
+14
-14
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<1e6850b081289af106b87495ff38a48d>>
|
||||
* @generated SignedSource<<0a7a4cb297cbefaedb16aca477b696a7>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -8660,20 +8660,20 @@ to return true:wantsResponderID| |
|
||||
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;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
checkIfUseWrappedInAsyncCatch(_rejectedError);
|
||||
throw _rejectedError;
|
||||
}
|
||||
case "rejected": {
|
||||
var rejectedThenable = thenable;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
checkIfUseWrappedInAsyncCatch(_rejectedError);
|
||||
throw _rejectedError;
|
||||
}
|
||||
} // Suspend.
|
||||
//
|
||||
@@ -27759,7 +27759,7 @@ to return true:wantsResponderID| |
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-f30a24ae";
|
||||
var ReactVersion = "18.3.0-canary-1c3755aa";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<8911fd923383beea165b606e91b1d716>>
|
||||
* @generated SignedSource<<fc95ca49937d1f46da732c34d4fb8f5a>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2697,16 +2697,16 @@ function trackUsedThenable(thenableState, thenable, index) {
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
}
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
suspendedThenable = thenable;
|
||||
throw SuspenseException;
|
||||
@@ -9533,7 +9533,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1070 = {
|
||||
findFiberByHostInstance: getInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-2ee69b0b",
|
||||
version: "18.3.0-canary-0b7d95b8",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -9576,7 +9576,7 @@ var internals$jscomp$inline_1295 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-2ee69b0b"
|
||||
reconcilerVersion: "18.3.0-canary-0b7d95b8"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1296 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<7f0716b8572ee9c92294ac976ce341c4>>
|
||||
* @generated SignedSource<<800d1da7837f2a323a32fd5aeda3ac6a>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2822,16 +2822,16 @@ function trackUsedThenable(thenableState, thenable, index) {
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
}
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
suspendedThenable = thenable;
|
||||
throw SuspenseException;
|
||||
@@ -10232,7 +10232,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1148 = {
|
||||
findFiberByHostInstance: getInstanceFromNode,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-56cd92e7",
|
||||
version: "18.3.0-canary-238d0e7e",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -10288,7 +10288,7 @@ var roots = new Map(),
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-56cd92e7"
|
||||
reconcilerVersion: "18.3.0-canary-238d0e7e"
|
||||
});
|
||||
exports.createPortal = function (children, containerTag) {
|
||||
return createPortal$1(
|
||||
|
||||
+14
-14
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<0d06e547a6cd0c1810b6eaac83860f87>>
|
||||
* @generated SignedSource<<2c1c4e4b5396fa0baf10b58ee57031f6>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -8932,20 +8932,20 @@ to return true:wantsResponderID| |
|
||||
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;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
checkIfUseWrappedInAsyncCatch(_rejectedError);
|
||||
throw _rejectedError;
|
||||
}
|
||||
case "rejected": {
|
||||
var rejectedThenable = thenable;
|
||||
var _rejectedError = rejectedThenable.reason;
|
||||
checkIfUseWrappedInAsyncCatch(_rejectedError);
|
||||
throw _rejectedError;
|
||||
}
|
||||
} // Suspend.
|
||||
//
|
||||
@@ -28200,7 +28200,7 @@ to return true:wantsResponderID| |
|
||||
return root;
|
||||
}
|
||||
|
||||
var ReactVersion = "18.3.0-canary-2c1d8ed1";
|
||||
var ReactVersion = "18.3.0-canary-54ae0c74";
|
||||
|
||||
function createPortal$1(
|
||||
children,
|
||||
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<39cc3a87ca227564cdd813f55956ea9b>>
|
||||
* @generated SignedSource<<317e792f1cd9362e1233f87a5e42e7b9>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2762,16 +2762,16 @@ function trackUsedThenable(thenableState, thenable, index) {
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
}
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
suspendedThenable = thenable;
|
||||
throw SuspenseException;
|
||||
@@ -9754,7 +9754,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1139 = {
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-b7eb11d7",
|
||||
version: "18.3.0-canary-00814a23",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -9797,7 +9797,7 @@ var internals$jscomp$inline_1378 = {
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-b7eb11d7"
|
||||
reconcilerVersion: "18.3.0-canary-00814a23"
|
||||
};
|
||||
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
var hook$jscomp$inline_1379 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
+13
-13
@@ -7,7 +7,7 @@
|
||||
* @noflow
|
||||
* @nolint
|
||||
* @preventMunge
|
||||
* @generated SignedSource<<84be8015422d9433af73cde9cdcf7115>>
|
||||
* @generated SignedSource<<79f8b34e6781e6dfbd8b98e53067b470>>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
@@ -2886,16 +2886,16 @@ function trackUsedThenable(thenableState, thenable, index) {
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
}
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw (
|
||||
((thenableState = thenable.reason),
|
||||
checkIfUseWrappedInAsyncCatch(thenableState),
|
||||
thenableState)
|
||||
);
|
||||
}
|
||||
suspendedThenable = thenable;
|
||||
throw SuspenseException;
|
||||
@@ -10452,7 +10452,7 @@ var roots = new Map(),
|
||||
devToolsConfig$jscomp$inline_1217 = {
|
||||
findFiberByHostInstance: getInstanceFromTag,
|
||||
bundleType: 0,
|
||||
version: "18.3.0-canary-9321130d",
|
||||
version: "18.3.0-canary-7f0ee2d4",
|
||||
rendererPackageName: "react-native-renderer",
|
||||
rendererConfig: {
|
||||
getInspectorDataForInstance: getInspectorDataForInstance,
|
||||
@@ -10508,7 +10508,7 @@ var roots = new Map(),
|
||||
scheduleRoot: null,
|
||||
setRefreshHandler: null,
|
||||
getCurrentFiber: null,
|
||||
reconcilerVersion: "18.3.0-canary-9321130d"
|
||||
reconcilerVersion: "18.3.0-canary-7f0ee2d4"
|
||||
});
|
||||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
||||
computeComponentStackForErrorReporting: function (reactTag) {
|
||||
|
||||
Reference in New Issue
Block a user