diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 60b652c8de..21794b6d12 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -11c9fd0c53133f24f5270d36591b65b8fc2ebd25 +b123b9c4f054a7def7ed84e350ccd46cc86672a6 diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 37e5f33c4c..884745c851 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-www-modern-50d838b5"; + var ReactVersion = "18.3.0-www-modern-60875b50"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index e802bc90e2..90c2b0295d 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); - var ReactVersion = "18.3.0-www-classic-78570fc1"; + var ReactVersion = "18.3.0-www-classic-64786d51"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -12381,9 +12381,13 @@ if (__DEV__) { // something suspends. task.node = node; - task.childIndex = childIndex; // Handle object types + task.childIndex = childIndex; - if (typeof node === "object" && node !== null) { + if (node === null) { + return; + } // Handle object types + + if (typeof node === "object") { switch (node.$$typeof) { case REACT_ELEMENT_TYPE: { var element = node; diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index 5c5409cbb9..912fcaf542 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); - var ReactVersion = "18.3.0-www-modern-ac3cce8e"; + var ReactVersion = "18.3.0-www-modern-6b2064ea"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -12109,9 +12109,13 @@ if (__DEV__) { // something suspends. task.node = node; - task.childIndex = childIndex; // Handle object types + task.childIndex = childIndex; - if (typeof node === "object" && node !== null) { + if (node === null) { + return; + } // Handle object types + + if (typeof node === "object") { switch (node.$$typeof) { case REACT_ELEMENT_TYPE: { var element = node; diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 1ab7bc8b2e..8b8f254fc0 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -4181,10 +4181,12 @@ function renderNodeDestructive( ) { if (null !== task.replay && "number" === typeof task.replay.slots) resumeNode(request, task, task.replay.slots, node$jscomp$0, childIndex); - else { - task.node = node$jscomp$0; - task.childIndex = childIndex; - if ("object" === typeof node$jscomp$0 && null !== node$jscomp$0) { + else if ( + ((task.node = node$jscomp$0), + (task.childIndex = childIndex), + null !== node$jscomp$0) + ) { + if ("object" === typeof node$jscomp$0) { switch (node$jscomp$0.$$typeof) { case REACT_ELEMENT_TYPE: var type = node$jscomp$0.type, @@ -5679,4 +5681,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-d74fa614"; +exports.version = "18.3.0-www-classic-1bb2d37b"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index bb48d07756..433e4f0df1 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -4106,10 +4106,12 @@ function renderNodeDestructive( ) { if (null !== task.replay && "number" === typeof task.replay.slots) resumeNode(request, task, task.replay.slots, node$jscomp$0, childIndex); - else { - task.node = node$jscomp$0; - task.childIndex = childIndex; - if ("object" === typeof node$jscomp$0 && null !== node$jscomp$0) { + else if ( + ((task.node = node$jscomp$0), + (task.childIndex = childIndex), + null !== node$jscomp$0) + ) { + if ("object" === typeof node$jscomp$0) { switch (node$jscomp$0.$$typeof) { case REACT_ELEMENT_TYPE: var type = node$jscomp$0.type, @@ -5604,4 +5606,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-15ac7325"; +exports.version = "18.3.0-www-modern-9e4e0a80"; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index 9e23e19d3a..25c79f496e 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -11988,9 +11988,13 @@ if (__DEV__) { // something suspends. task.node = node; - task.childIndex = childIndex; // Handle object types + task.childIndex = childIndex; - if (typeof node === "object" && node !== null) { + if (node === null) { + return; + } // Handle object types + + if (typeof node === "object") { switch (node.$$typeof) { case REACT_ELEMENT_TYPE: { var element = node; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js index 99243d8aa3..e7da96677b 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js @@ -3929,10 +3929,12 @@ function renderNodeDestructive( ) { if (null !== task.replay && "number" === typeof task.replay.slots) resumeNode(request, task, task.replay.slots, node$jscomp$0, childIndex); - else { - task.node = node$jscomp$0; - task.childIndex = childIndex; - if ("object" === typeof node$jscomp$0 && null !== node$jscomp$0) { + else if ( + ((task.node = node$jscomp$0), + (task.childIndex = childIndex), + null !== node$jscomp$0) + ) { + if ("object" === typeof node$jscomp$0) { switch (node$jscomp$0.$$typeof) { case REACT_ELEMENT_TYPE: var type = node$jscomp$0.type, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 8afab70d9f..f4e6ee4093 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -16527,7 +16527,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1767 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-bf87f54a", + version: "18.3.0-www-modern-35dbc68d", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2124 = { @@ -16558,7 +16558,7 @@ var internals$jscomp$inline_2124 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-bf87f54a" + reconcilerVersion: "18.3.0-www-modern-35dbc68d" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2125 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16973,4 +16973,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-bf87f54a"; +exports.version = "18.3.0-www-modern-35dbc68d"; diff --git a/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js b/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js index 029b2587e3..89619dcbaa 100644 --- a/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js @@ -1308,11 +1308,7 @@ if (__DEV__) { taintCleanupQueue: cleanupQueue, onError: onError === undefined ? defaultErrorHandler : onError, onPostpone: - onPostpone === undefined ? defaultPostponeHandler : onPostpone, - // $FlowFixMe[missing-this-annot] - toJSON: function (key, value) { - return resolveModelToJSON(request, this, key, value); - } + onPostpone === undefined ? defaultPostponeHandler : onPostpone }; request.pendingChunks++; var rootContext = createRootContext(); @@ -1482,8 +1478,9 @@ if (__DEV__) { return lazyType; } - function attemptResolveElement( + function renderElement( request, + task, type, key, ref, @@ -1530,10 +1527,17 @@ if (__DEV__) { } // TODO: Once we accept Promises as children on the client, we can just return // the thenable here. - return createLazyWrapperAroundWakeable(result); + result = createLazyWrapperAroundWakeable(result); } - return result; + return renderModelDestructive( + request, + task, + emptyRoot, + "", + result, + null + ); } else if (typeof type === "string") { // This is a host element. E.g. HTML. return [REACT_ELEMENT_TYPE, type, key, props]; @@ -1543,7 +1547,14 @@ if (__DEV__) { // it as a wrapper. // TODO: If a key is specified, we should propagate its key to any children. // Same as if a Server Component has a key. - return props.children; + return renderModelDestructive( + request, + task, + emptyRoot, + "", + props.children, + null + ); } // This might be a built-in React component. We'll let the client decide. // Any built-in works as long as its props are serializable. @@ -1559,8 +1570,9 @@ if (__DEV__) { var payload = type._payload; var init = type._init; var wrappedType = init(payload); - return attemptResolveElement( + return renderElement( request, + task, wrappedType, key, ref, @@ -1572,12 +1584,23 @@ if (__DEV__) { case REACT_FORWARD_REF_TYPE: { var render = type.render; prepareToUseHooksForComponent(prevThenableState); - return render(props, undefined); + + var _result = render(props, undefined); + + return renderModelDestructive( + request, + task, + emptyRoot, + "", + _result, + null + ); } case REACT_MEMO_TYPE: { - return attemptResolveElement( + return renderElement( request, + task, type.type, key, ref, @@ -1608,6 +1631,12 @@ if (__DEV__) { function createTask(request, model, context, abortSet) { var id = request.nextChunkId++; + + if (typeof model === "object" && model !== null) { + // Register this model as having the ID we're about to write. + request.writtenObjects.set(model, id); + } + var task = { id: id, status: PENDING, @@ -1616,6 +1645,48 @@ if (__DEV__) { ping: function () { return pingTask(request, task); }, + toJSON: function (parentPropertyName, value) { + var parent = this; // Make sure that `parent[parentPropertyName]` wasn't JSONified before `value` was passed to us + + { + // $FlowFixMe[incompatible-use] + var originalValue = parent[parentPropertyName]; + + if ( + typeof originalValue === "object" && + originalValue !== value && + !(originalValue instanceof Date) + ) { + if (objectName(originalValue) !== "Object") { + var jsxParentType = jsxChildrenParents.get(parent); + + if (typeof jsxParentType === "string") { + error( + "%s objects cannot be rendered as text children. Try formatting it using toString().%s", + objectName(originalValue), + describeObjectForErrorMessage(parent, parentPropertyName) + ); + } else { + error( + "Only plain objects can be passed to Client Components from Server Components. " + + "%s objects are not supported.%s", + objectName(originalValue), + describeObjectForErrorMessage(parent, parentPropertyName) + ); + } + } else { + error( + "Only plain objects can be passed to Client Components from Server Components. " + + "Objects with toJSON methods are not supported. Convert it manually " + + "to a simple value before passing it to props.%s", + describeObjectForErrorMessage(parent, parentPropertyName) + ); + } + } + } + + return renderModel(request, task, parent, parentPropertyName, value); + }, thenableState: null }; abortSet.add(task); @@ -1684,13 +1755,18 @@ if (__DEV__) { return stringToChunk(row); } - function serializeClientReference(request, parent, key, clientReference) { + function serializeClientReference( + request, + parent, + parentPropertyName, + clientReference + ) { var clientReferenceKey = getClientReferenceKey(clientReference); var writtenClientReferences = request.writtenClientReferences; var existingId = writtenClientReferences.get(clientReferenceKey); if (existingId !== undefined) { - if (parent[0] === REACT_ELEMENT_TYPE && key === "1") { + if (parent[0] === REACT_ELEMENT_TYPE && parentPropertyName === "1") { // If we're encoding the "type" of an element, we can refer // to that by a lazy reference instead of directly since React // knows how to deal with lazy values. This lets us suspend @@ -1712,7 +1788,7 @@ if (__DEV__) { emitImportChunk(request, importId, clientReferenceMetadata); writtenClientReferences.set(clientReferenceKey, importId); - if (parent[0] === REACT_ELEMENT_TYPE && key === "1") { + if (parent[0] === REACT_ELEMENT_TYPE && parentPropertyName === "1") { // If we're encoding the "type" of an element, we can refer // to that by a lazy reference instead of directly since React // knows how to deal with lazy values. This lets us suspend @@ -1743,7 +1819,7 @@ if (__DEV__) { return newTask.id; } - function serializeServerReference(request, parent, key, serverReference) { + function serializeServerReference(request, serverReference) { var writtenServerReferences = request.writtenServerReferences; var existingId = writtenServerReferences.get(serverReference); @@ -1825,138 +1901,80 @@ if (__DEV__) { } var modelRoot = false; - function resolveModelToJSON(request, parent, key, value) { - // Make sure that `parent[key]` wasn't JSONified before `value` was passed to us - { - // $FlowFixMe[incompatible-use] - var originalValue = parent[key]; + function renderModel(request, task, parent, key, value) { + try { + return renderModelDestructive(request, task, parent, key, value, null); + } catch (thrownValue) { + var x = + thrownValue === SuspenseException // This is a special type of exception used for Suspense. For historical + ? // reasons, the rest of the Suspense implementation expects the thrown + // value to be a thenable, because before `use` existed that was the + // (unstable) API for suspending. This implementation detail can change + // later, once we deprecate the old API in favor of `use`. + getSuspendedThenable() + : thrownValue; // If the suspended/errored value was an element or lazy it can be reduced + // to a lazy reference, so that it doesn't error the parent. - if ( - typeof originalValue === "object" && - originalValue !== value && - !(originalValue instanceof Date) - ) { - if (objectName(originalValue) !== "Object") { - var jsxParentType = jsxChildrenParents.get(parent); + var model = task.model; + var wasReactNode = + typeof model === "object" && + model !== null && + (model.$$typeof === REACT_ELEMENT_TYPE || + model.$$typeof === REACT_LAZY_TYPE); - if (typeof jsxParentType === "string") { - error( - "%s objects cannot be rendered as text children. Try formatting it using toString().%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } else { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "%s objects are not supported.%s", - objectName(originalValue), - describeObjectForErrorMessage(parent, key) - ); - } - } else { - error( - "Only plain objects can be passed to Client Components from Server Components. " + - "Objects with toJSON methods are not supported. Convert it manually " + - "to a simple value before passing it to props.%s", - describeObjectForErrorMessage(parent, key) + if (typeof x === "object" && x !== null) { + // $FlowFixMe[method-unbinding] + if (typeof x.then === "function") { + // Something suspended, we'll need to create a new task and resolve it later. + request.pendingChunks++; + var newTask = createTask( + request, + task.model, + getActiveContext(), + request.abortableTasks ); - } - } - } // Special Symbols + var ping = newTask.ping; + x.then(ping, ping); + newTask.thenableState = getThenableStateAfterSuspending(); - switch (value) { - case REACT_ELEMENT_TYPE: - return "$"; - } - - while ( - typeof value === "object" && - value !== null && - (value.$$typeof === REACT_ELEMENT_TYPE || - value.$$typeof === REACT_LAZY_TYPE) - ) { - try { - switch (value.$$typeof) { - case REACT_ELEMENT_TYPE: { - var writtenObjects = request.writtenObjects; - var existingId = writtenObjects.get(value); - - if (existingId !== undefined) { - if (existingId === -1) { - // Seen but not yet outlined. - var newId = outlineModel(request, value); - return serializeByValueID(newId); - } else if (modelRoot === value) { - // This is the ID we're currently emitting so we need to write it - // once but if we discover it again, we refer to it by id. - modelRoot = null; - } else { - // We've already emitted this as an outlined object, so we can - // just refer to that by its existing ID. - return serializeByValueID(existingId); - } - } else { - // This is the first time we've seen this object. We may never see it again - // so we'll inline it. Mark it as seen. If we see it again, we'll outline. - writtenObjects.set(value, -1); - } // TODO: Concatenate keys of parents onto children. - - var element = value; // Attempt to render the Server Component. - - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - ); - break; - } - - case REACT_LAZY_TYPE: { - var payload = value._payload; - var init = value._init; - value = init(payload); - break; - } - } - } catch (thrownValue) { - var x = - thrownValue === SuspenseException // This is a special type of exception used for Suspense. For historical - ? // reasons, the rest of the Suspense implementation expects the thrown - // value to be a thenable, because before `use` existed that was the - // (unstable) API for suspending. This implementation detail can change - // later, once we deprecate the old API in favor of `use`. - getSuspendedThenable() - : thrownValue; - - if (typeof x === "object" && x !== null) { - // $FlowFixMe[method-unbinding] - if (typeof x.then === "function") { - // Something suspended, we'll need to create a new task and resolve it later. - request.pendingChunks++; - var newTask = createTask( - request, - value, - getActiveContext(), - request.abortableTasks - ); - var ping = newTask.ping; - x.then(ping, ping); - newTask.thenableState = getThenableStateAfterSuspending(); + if (wasReactNode) { return serializeLazyID(newTask.id); } - } // Something errored. We'll still send everything we have up until this point. + + return serializeByValueID(newTask.id); + } + } + + if (wasReactNode) { + // 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 // once it gets rendered. - request.pendingChunks++; var errorId = request.nextChunkId++; var digest = logRecoverableError(request, x); emitErrorChunk(request, errorId, digest, x); return serializeLazyID(errorId); - } + } // Something errored but it was not in a React Node. There's no need to serialize + // it by value because it'll just error the whole parent row anyway so we can + // just stop any siblings and error the whole parent row. + + throw x; + } + } + + function renderModelDestructive( + request, + task, + parent, + parentPropertyName, + value, + prevThenableState + ) { + // Set the currently rendering model + task.model = value; // Special Symbol, that's very common. + + if (value === REACT_ELEMENT_TYPE) { + return "$"; } if (value === null) { @@ -1964,36 +1982,92 @@ if (__DEV__) { } if (typeof value === "object") { - if (isClientReference(value)) { - return serializeClientReference(request, parent, key, value); + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: { + var _writtenObjects = request.writtenObjects; + + var _existingId = _writtenObjects.get(value); + + if (_existingId !== undefined) { + if (_existingId === -1) { + // Seen but not yet outlined. + var newId = outlineModel(request, value); + return serializeByValueID(newId); + } else if (modelRoot === value) { + // This is the ID we're currently emitting so we need to write it + // once but if we discover it again, we refer to it by id. + modelRoot = null; + } else { + // We've already emitted this as an outlined object, so we can + // just refer to that by its existing ID. + return serializeByValueID(_existingId); + } + } else { + // This is the first time we've seen this object. We may never see it again + // so we'll inline it. Mark it as seen. If we see it again, we'll outline. + _writtenObjects.set(value, -1); + } // TODO: Concatenate keys of parents onto children. + + var element = value; // Attempt to render the Server Component. + + return renderElement( + request, + task, + element.type, + element.key, + element.ref, + element.props, + prevThenableState + ); + } + + case REACT_LAZY_TYPE: { + var payload = value._payload; + var init = value._init; + var resolvedModel = init(payload); + return renderModelDestructive( + request, + task, + emptyRoot, + "", + resolvedModel, + null + ); + } } - var _writtenObjects = request.writtenObjects; + if (isClientReference(value)) { + return serializeClientReference( + request, + parent, + parentPropertyName, + value + ); + } - var _existingId = _writtenObjects.get(value); // $FlowFixMe[method-unbinding] + var writtenObjects = request.writtenObjects; + var existingId = writtenObjects.get(value); // $FlowFixMe[method-unbinding] if (typeof value.then === "function") { - if (_existingId !== undefined) { + if (existingId !== undefined) { if (modelRoot === value) { // This is the ID we're currently emitting so we need to write it // once but if we discover it again, we refer to it by id. modelRoot = null; } else { // We've seen this promise before, so we can just refer to the same result. - return serializePromiseID(_existingId); + return serializePromiseID(existingId); } } // 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); - - _writtenObjects.set(value, promiseId); - + writtenObjects.set(value, promiseId); return serializePromiseID(promiseId); } - if (_existingId !== undefined) { - if (_existingId === -1) { + if (existingId !== undefined) { + if (existingId === -1) { // Seen but not yet outlined. var _newId = outlineModel(request, value); @@ -2005,12 +2079,12 @@ if (__DEV__) { } else { // We've already emitted this as an outlined object, so we can // just refer to that by its existing ID. - return serializeByValueID(_existingId); + return serializeByValueID(existingId); } } else { // This is the first time we've seen this object. We may never see it again // so we'll inline it. Mark it as seen. If we see it again, we'll outline. - _writtenObjects.set(value, -1); + writtenObjects.set(value, -1); } if (isArray(value)) { @@ -2050,13 +2124,13 @@ if (__DEV__) { "Only plain objects can be passed to Client Components from Server Components. " + "%s objects are not supported.%s", objectName(value), - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } else if (!isSimpleObject(value)) { error( "Only plain objects can be passed to Client Components from Server Components. " + "Classes or other objects with methods are not supported.%s", - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } else if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(value); @@ -2066,7 +2140,7 @@ if (__DEV__) { "Only plain objects can be passed to Client Components from Server Components. " + "Objects with symbol properties like %s are not supported.%s", symbols[0].description, - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } } @@ -2079,9 +2153,9 @@ if (__DEV__) { if (value[value.length - 1] === "Z") { // Possibly a Date, whose toJSON automatically calls toISOString // $FlowFixMe[incompatible-use] - var _originalValue = parent[key]; + var originalValue = parent[parentPropertyName]; - if (_originalValue instanceof Date) { + if (originalValue instanceof Date) { return serializeDateFromDateJSON(value); } } @@ -2110,24 +2184,29 @@ if (__DEV__) { if (typeof value === "function") { if (isClientReference(value)) { - return serializeClientReference(request, parent, key, value); + return serializeClientReference( + request, + parent, + parentPropertyName, + value + ); } if (isServerReference()) { - return serializeServerReference(request, parent, key, value); + return serializeServerReference(request, value); } - if (/^on[A-Z]/.test(key)) { + if (/^on[A-Z]/.test(parentPropertyName)) { throw new Error( "Event handlers cannot be passed to Client Component props." + - describeObjectForErrorMessage(parent, key) + + describeObjectForErrorMessage(parent, parentPropertyName) + "\nIf you need interactivity, consider converting part of this to a Client Component." ); } else { throw new Error( "Functions cannot be passed directly to Client Components " + 'unless you explicitly expose it by marking it with "use server".' + - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } } @@ -2149,7 +2228,7 @@ if (__DEV__) { ("The symbol Symbol.for(" + // $FlowFixMe[incompatible-type] `description` might be undefined value.description + ") cannot be found among global symbols.") + - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } @@ -2168,7 +2247,7 @@ if (__DEV__) { "Type " + typeof value + " is not supported in Client Component props." + - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } @@ -2253,18 +2332,14 @@ if (__DEV__) { request.completedImportChunks.push(processedChunk); } - function emitModelChunk(request, id, model) { - // Track the root so we know that we have to emit this object even though it - // already has an ID. This is needed because we might see this object twice - // in the same toJSON if it is cyclic. - modelRoot = model; // $FlowFixMe[incompatible-type] stringify can return null - - var json = stringify(model, request.toJSON); + function emitModelChunk(request, id, json) { var row = id.toString(16) + ":" + json + "\n"; var processedChunk = stringToChunk(row); request.completedRegularChunks.push(processedChunk); } + var emptyRoot = {}; + function retryTask(request, task) { if (task.status !== PENDING) { // We completed this by other means before we had a chance to retry it. @@ -2274,62 +2349,37 @@ if (__DEV__) { switchContext(task.context); try { - var value = task.model; + // Reset the task's thenable state before continuing, so that if a later + // component suspends we can reuse the same task object. If the same + // component suspends again, the thenable state will be restored. + var prevThenableState = task.thenableState; + task.thenableState = null; // Track the root so we know that we have to emit this object even though it + // already has an ID. This is needed because we might see this object twice + // in the same toJSON if it is cyclic. - if ( - typeof value === "object" && - value !== null && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - request.writtenObjects.set(value, task.id); // TODO: Concatenate keys of parents onto children. + modelRoot = task.model; // We call the destructive form that mutates this task. That way if something + // suspends again, we can reuse the same task instead of spawning a new one. - var element = value; // When retrying a component, reuse the thenableState from the - // previous attempt. + var resolvedModel = renderModelDestructive( + request, + task, + emptyRoot, + "", + task.model, + prevThenableState + ); // Track the root again for the resolved object. - var prevThenableState = task.thenableState; // Attempt to render the Server Component. - // Doing this here lets us reuse this same task if the next component - // also suspends. + modelRoot = resolvedModel; // If the value is a string, it means it's a terminal value adn we already escaped it + // We don't need to escape it again so it's not passed the toJSON replacer. + // Object might contain unresolved values like additional elements. + // This is simulating what the JSON loop would do if this was part of it. + // $FlowFixMe[incompatible-type] stringify can return null - task.model = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - prevThenableState - ); // Successfully finished this component. We're going to keep rendering - // using the same task, but we reset its thenable state before continuing. - - task.thenableState = null; // Keep rendering and reuse the same task. This inner loop is separate - // from the render above because we don't need to reset the thenable state - // until the next time something suspends and retries. - - while ( - typeof value === "object" && - value !== null && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - request.writtenObjects.set(value, task.id); // TODO: Concatenate keys of parents onto children. - - var nextElement = value; - task.model = value; - value = attemptResolveElement( - request, - nextElement.type, - nextElement.key, - nextElement.ref, - nextElement.props, - null - ); - } - } // Track that this object is outlined and has an id. - - if (typeof value === "object" && value !== null) { - request.writtenObjects.set(value, task.id); - } - - emitModelChunk(request, task.id, value); + var json = + typeof resolvedModel === "string" + ? stringify(resolvedModel) + : stringify(resolvedModel, task.toJSON); + emitModelChunk(request, task.id, json); request.abortableTasks.delete(task); task.status = COMPLETED; } catch (thrownValue) { diff --git a/compiled/facebook-www/ReactFlightDOMServer-prod.modern.js b/compiled/facebook-www/ReactFlightDOMServer-prod.modern.js index ffda9963fd..78e0363c2e 100644 --- a/compiled/facebook-www/ReactFlightDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactFlightDOMServer-prod.modern.js @@ -497,59 +497,6 @@ function defaultErrorHandler(error) { console.error(error); } function defaultPostponeHandler() {} -function createRequest( - model, - bundlerConfig, - onError, - context, - identifierPrefix, - onPostpone -) { - if ( - null !== ReactCurrentCache.current && - ReactCurrentCache.current !== DefaultCacheDispatcher - ) - throw Error("Currently React only supports one RSC renderer at a time."); - ReactDOMCurrentDispatcher.current = ReactDOMFlightServerDispatcher; - ReactCurrentCache.current = DefaultCacheDispatcher; - var abortSet = new Set(); - context = []; - var hints = new Set(), - request = { - status: 0, - flushScheduled: !1, - fatalError: null, - destination: null, - bundlerConfig: bundlerConfig, - cache: new Map(), - nextChunkId: 0, - pendingChunks: 0, - hints: hints, - abortableTasks: abortSet, - pingedTasks: context, - completedImportChunks: [], - completedHintChunks: [], - completedRegularChunks: [], - completedErrorChunks: [], - writtenSymbols: new Map(), - writtenClientReferences: new Map(), - writtenServerReferences: new Map(), - writtenProviders: new Map(), - writtenObjects: new WeakMap(), - identifierPrefix: identifierPrefix || "", - identifierCount: 1, - taintCleanupQueue: [], - onError: void 0 === onError ? defaultErrorHandler : onError, - onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone, - toJSON: function (key, value) { - return resolveModelToJSON(request, this, key, value); - } - }; - request.pendingChunks++; - model = createTask(request, model, null, abortSet); - context.push(model); - return request; -} var currentRequest = null; function serializeThenable(request, thenable) { request.pendingChunks++; @@ -639,8 +586,9 @@ function createLazyWrapperAroundWakeable(wakeable) { } return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } -function attemptResolveElement( +function renderElement( request, + task, type, key, ref, @@ -656,18 +604,29 @@ function attemptResolveElement( thenableIndexCounter = 0; thenableState = prevThenableState; props = type(props); - return "object" === typeof props && + if ( + "object" === typeof props && null !== props && "function" === typeof props.then - ? "fulfilled" === props.status - ? props.value - : createLazyWrapperAroundWakeable(props) - : props; + ) { + prevThenableState = props; + if ("fulfilled" === prevThenableState.status) + return prevThenableState.value; + props = createLazyWrapperAroundWakeable(props); + } + return renderModelDestructive(request, task, emptyRoot, "", props, null); } if ("string" === typeof type) return [REACT_ELEMENT_TYPE, type, key, props]; if ("symbol" === typeof type) return type === REACT_FRAGMENT_TYPE - ? props.children + ? renderModelDestructive( + request, + task, + emptyRoot, + "", + props.children, + null + ) : [REACT_ELEMENT_TYPE, type, key, props]; if (null != type && "object" === typeof type) { if (isClientReference(type)) return [REACT_ELEMENT_TYPE, type, key, props]; @@ -675,8 +634,9 @@ function attemptResolveElement( case REACT_LAZY_TYPE: var init = type._init; type = init(type._payload); - return attemptResolveElement( + return renderElement( request, + task, type, key, ref, @@ -685,14 +645,16 @@ function attemptResolveElement( ); case REACT_FORWARD_REF_TYPE: return ( - (request = type.render), + (key = type.render), (thenableIndexCounter = 0), (thenableState = prevThenableState), - request(props, void 0) + (props = key(props, void 0)), + renderModelDestructive(request, task, emptyRoot, "", props, null) ); case REACT_MEMO_TYPE: - return attemptResolveElement( + return renderElement( request, + task, type.type, key, ref, @@ -713,14 +675,71 @@ function pingTask(request, task) { performWork(request)); } function createTask(request, model, context, abortSet) { + var id = request.nextChunkId++; + "object" === typeof model && + null !== model && + request.writtenObjects.set(model, id); var task = { - id: request.nextChunkId++, + id: id, status: 0, model: model, context: context, ping: function () { return pingTask(request, task); }, + toJSON: function (parentPropertyName, value) { + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value, + null + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + (value = task.model), + (value = + "object" === typeof value && + null !== value && + (value.$$typeof === REACT_ELEMENT_TYPE || + value.$$typeof === REACT_LAZY_TYPE)), + "object" === typeof parentPropertyName && + null !== parentPropertyName && + "function" === typeof parentPropertyName.then) + ) { + request.pendingChunks++; + JSCompiler_inline_result = createTask( + request, + task.model, + currentActiveSnapshot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + parentPropertyName.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + JSCompiler_inline_result = value + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else if (value) + request.pendingChunks++, + (value = request.nextChunkId++), + (parentPropertyName = logRecoverableError( + request, + parentPropertyName + )), + emitErrorChunk(request, value, parentPropertyName), + (JSCompiler_inline_result = "$L" + value.toString(16)); + else throw parentPropertyName; + } + return JSCompiler_inline_result; + }, thenableState: null }; abortSet.add(task); @@ -729,14 +748,19 @@ function createTask(request, model, context, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeClientReference(request, parent, key, clientReference) { +function serializeClientReference( + request, + parent, + parentPropertyName, + clientReference +) { var JSCompiler_inline_result = clientReference.getModuleId(); requestedClientReferencesKeys.add(JSCompiler_inline_result); JSCompiler_inline_result = clientReference.getModuleId(); var writtenClientReferences = request.writtenClientReferences, existingId = writtenClientReferences.get(JSCompiler_inline_result); if (void 0 !== existingId) - return parent[0] === REACT_ELEMENT_TYPE && "1" === key + return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { @@ -750,15 +774,15 @@ function serializeClientReference(request, parent, key, clientReference) { processedChunk = importId.toString(16) + ":I" + json + "\n"; request.completedImportChunks.push(processedChunk); writtenClientReferences.set(JSCompiler_inline_result, importId); - return parent[0] === REACT_ELEMENT_TYPE && "1" === key + return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( request.pendingChunks++, (parent = request.nextChunkId++), - (key = logRecoverableError(request, x)), - emitErrorChunk(request, parent, key), + (parentPropertyName = logRecoverableError(request, x)), + emitErrorChunk(request, parent, parentPropertyName), serializeByValueID(parent) ); } @@ -775,116 +799,93 @@ function outlineModel(request, value) { return value.id; } var modelRoot = !1; -function resolveModelToJSON(request, parent, key, value) { - switch (value) { - case REACT_ELEMENT_TYPE: - return "$"; - } - for ( - ; - "object" === typeof value && - null !== value && - (value.$$typeof === REACT_ELEMENT_TYPE || - value.$$typeof === REACT_LAZY_TYPE); - - ) - try { - switch (value.$$typeof) { - case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects, - existingId = writtenObjects.get(value); - if (void 0 !== existingId) { - if (-1 === existingId) { - var newId = outlineModel(request, value); - return serializeByValueID(newId); - } - if (modelRoot === value) modelRoot = null; - else return serializeByValueID(existingId); - } else writtenObjects.set(value, -1); - var element = value; - value = attemptResolveElement( - request, - element.type, - element.key, - element.ref, - element.props, - null - ); - break; - case REACT_LAZY_TYPE: - var init = value._init; - value = init(value._payload); - } - } catch (thrownValue) { - parent = - thrownValue === SuspenseException - ? getSuspendedThenable() - : thrownValue; - if ( - "object" === typeof parent && - null !== parent && - "function" === typeof parent.then - ) - return ( - request.pendingChunks++, - (request = createTask( - request, - value, - currentActiveSnapshot, - request.abortableTasks - )), - (value = request.ping), - parent.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - "$L" + request.id.toString(16) - ); - request.pendingChunks++; - value = request.nextChunkId++; - parent = logRecoverableError(request, parent); - emitErrorChunk(request, value, parent); - return "$L" + value.toString(16); - } +function renderModelDestructive( + request, + task, + parent, + parentPropertyName, + value, + prevThenableState +) { + task.model = value; + if (value === REACT_ELEMENT_TYPE) return "$"; if (null === value) return null; if ("object" === typeof value) { + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + parent = request.writtenObjects; + parentPropertyName = parent.get(value); + if (void 0 !== parentPropertyName) { + if (-1 === parentPropertyName) + return ( + (request = outlineModel(request, value)), + serializeByValueID(request) + ); + if (modelRoot === value) modelRoot = null; + else return serializeByValueID(parentPropertyName); + } else parent.set(value, -1); + return renderElement( + request, + task, + value.type, + value.key, + value.ref, + value.props, + prevThenableState + ); + case REACT_LAZY_TYPE: + return ( + (parent = value._init), + (value = parent(value._payload)), + renderModelDestructive(request, task, emptyRoot, "", value, null) + ); + } if (isClientReference(value)) - return serializeClientReference(request, parent, key, value); - parent = request.writtenObjects; - key = parent.get(value); + return serializeClientReference( + request, + parent, + parentPropertyName, + value + ); + task = request.writtenObjects; + parent = task.get(value); if ("function" === typeof value.then) { - if (void 0 !== key) + if (void 0 !== parent) if (modelRoot === value) modelRoot = null; - else return "$@" + key.toString(16); + else return "$@" + parent.toString(16); request = serializeThenable(request, value); - parent.set(value, request); + task.set(value, request); return "$@" + request.toString(16); } - if (void 0 !== key) { - if (-1 === key) + if (void 0 !== parent) { + if (-1 === parent) return ( (request = outlineModel(request, value)), serializeByValueID(request) ); if (modelRoot === value) modelRoot = null; - else return serializeByValueID(key); - } else parent.set(value, -1); + else return serializeByValueID(parent); + } else task.set(value, -1); if (isArrayImpl(value)) return value; if (value instanceof Map) { value = Array.from(value); - for (parent = 0; parent < value.length; parent++) - (key = value[parent][0]), - "object" === typeof key && - null !== key && - ((writtenObjects = request.writtenObjects), - void 0 === writtenObjects.get(key) && writtenObjects.set(key, -1)); + for (task = 0; task < value.length; task++) + (parent = value[task][0]), + "object" === typeof parent && + null !== parent && + ((parentPropertyName = request.writtenObjects), + void 0 === parentPropertyName.get(parent) && + parentPropertyName.set(parent, -1)); return "$Q" + outlineModel(request, value).toString(16); } if (value instanceof Set) { value = Array.from(value); - for (parent = 0; parent < value.length; parent++) - (key = value[parent]), - "object" === typeof key && - null !== key && - ((writtenObjects = request.writtenObjects), - void 0 === writtenObjects.get(key) && writtenObjects.set(key, -1)); + for (task = 0; task < value.length; task++) + (parent = value[task]), + "object" === typeof parent && + null !== parent && + ((parentPropertyName = request.writtenObjects), + void 0 === parentPropertyName.get(parent) && + parentPropertyName.set(parent, -1)); return "$W" + outlineModel(request, value).toString(16); } null === value || "object" !== typeof value @@ -905,60 +906,66 @@ function resolveModelToJSON(request, parent, key, value) { return value; } if ("string" === typeof value) { - if ("Z" === value[value.length - 1] && parent[key] instanceof Date) + if ( + "Z" === value[value.length - 1] && + parent[parentPropertyName] instanceof Date + ) return "$D" + value; if (1024 <= value.length) { request.pendingChunks += 2; - parent = request.nextChunkId++; + task = request.nextChunkId++; if (null == byteLengthImpl) throw Error( "byteLengthOfChunk implementation is not configured. Please, provide the implementation via ReactFlightDOMServer.setConfig(...);" ); - key = byteLengthImpl(value); - key = parent.toString(16) + ":T" + key.toString(16) + ","; - request.completedRegularChunks.push(key, value); - return serializeByValueID(parent); + parent = byteLengthImpl(value); + parent = task.toString(16) + ":T" + parent.toString(16) + ","; + request.completedRegularChunks.push(parent, value); + return serializeByValueID(task); } request = "$" === value[0] ? "$" + value : value; return request; } if ("boolean" === typeof value) return value; if ("number" === typeof value) - return ( - (request = value), - Number.isFinite(request) - ? 0 === request && -Infinity === 1 / request - ? "$-0" - : request - : Infinity === request - ? "$Infinity" - : -Infinity === request - ? "$-Infinity" - : "$NaN" - ); + return Number.isFinite(value) + ? 0 === value && -Infinity === 1 / value + ? "$-0" + : value + : Infinity === value + ? "$Infinity" + : -Infinity === value + ? "$-Infinity" + : "$NaN"; if ("undefined" === typeof value) return "$undefined"; if ("function" === typeof value) { if (isClientReference(value)) - return serializeClientReference(request, parent, key, value); + return serializeClientReference( + request, + parent, + parentPropertyName, + value + ); throw Error("isServerReference: Not Implemented."); } if ("symbol" === typeof value) { - writtenObjects = request.writtenSymbols; - existingId = writtenObjects.get(value); - if (void 0 !== existingId) return serializeByValueID(existingId); - existingId = value.description; - if (Symbol.for(existingId) !== value) + task = request.writtenSymbols; + prevThenableState = task.get(value); + if (void 0 !== prevThenableState) + return serializeByValueID(prevThenableState); + prevThenableState = value.description; + if (Symbol.for(prevThenableState) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); request.pendingChunks++; parent = request.nextChunkId++; - key = stringify("$S" + existingId); - key = parent.toString(16) + ":" + key + "\n"; - request.completedImportChunks.push(key); - writtenObjects.set(value, parent); + parentPropertyName = stringify("$S" + prevThenableState); + parentPropertyName = parent.toString(16) + ":" + parentPropertyName + "\n"; + request.completedImportChunks.push(parentPropertyName); + task.set(value, parent); return serializeByValueID(parent); } if ("bigint" === typeof value) return "$n" + value.toString(10); @@ -966,7 +973,7 @@ function resolveModelToJSON(request, parent, key, value) { "Type " + typeof value + " is not supported in Client Component props." + - describeObjectForErrorMessage(parent, key) + describeObjectForErrorMessage(parent, parentPropertyName) ); } function logRecoverableError(request, error) { @@ -993,6 +1000,7 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } +var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { var prev = currentActiveSnapshot, @@ -1009,66 +1017,41 @@ function retryTask(request, task) { : popNextToCommonLevel(prev, next), (currentActiveSnapshot = next)); try { - var value = task.model; - if ( - "object" === typeof value && - null !== value && - value.$$typeof === REACT_ELEMENT_TYPE - ) { - request.writtenObjects.set(value, task.id); - prev = value; - var prevThenableState = task.thenableState; - task.model = value; - value = attemptResolveElement( - request, - prev.type, - prev.key, - prev.ref, - prev.props, - prevThenableState - ); - for ( - task.thenableState = null; - "object" === typeof value && - null !== value && - value.$$typeof === REACT_ELEMENT_TYPE; - - ) - request.writtenObjects.set(value, task.id), - (prevThenableState = value), - (task.model = value), - (value = attemptResolveElement( - request, - prevThenableState.type, - prevThenableState.key, - prevThenableState.ref, - prevThenableState.props, - null - )); - } - "object" === typeof value && - null !== value && - request.writtenObjects.set(value, task.id); - var id = task.id; - modelRoot = value; - var json = stringify(value, request.toJSON), - processedChunk = id.toString(16) + ":" + json + "\n"; + var prevThenableState = task.thenableState; + task.thenableState = null; + modelRoot = task.model; + var resolvedModel = renderModelDestructive( + request, + task, + emptyRoot, + "", + task.model, + prevThenableState + ); + modelRoot = resolvedModel; + var json = + "string" === typeof resolvedModel + ? stringify(resolvedModel) + : stringify(resolvedModel, task.toJSON), + processedChunk = task.id.toString(16) + ":" + json + "\n"; request.completedRegularChunks.push(processedChunk); request.abortableTasks.delete(task); task.status = 1; } catch (thrownValue) { - (id = + (prev = thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue), - "object" === typeof id && null !== id && "function" === typeof id.then + "object" === typeof prev && + null !== prev && + "function" === typeof prev.then ? ((request = task.ping), - id.then(request, request), + prev.then(request, request), (task.thenableState = getThenableStateAfterSuspending())) : (request.abortableTasks.delete(task), (task.status = 4), - (id = logRecoverableError(request, id)), - emitErrorChunk(request, task.id, id)); + (prev = logRecoverableError(request, prev)), + emitErrorChunk(request, task.id, prev)); } } } @@ -1138,19 +1121,59 @@ exports.renderToDestination = function (destination, model, options) { throw Error( "Please make sure to call `setConfig(...)` before calling `renderToDestination`." ); - model = createRequest(model, null, options ? options.onError : void 0); - model.flushScheduled = null !== model.destination; - performWork(model); - if (1 === model.status) - (model.status = 2), - destination.onError(model.fatalError), + var onError = options ? options.onError : void 0; + if ( + null !== ReactCurrentCache.current && + ReactCurrentCache.current !== DefaultCacheDispatcher + ) + throw Error("Currently React only supports one RSC renderer at a time."); + ReactDOMCurrentDispatcher.current = ReactDOMFlightServerDispatcher; + ReactCurrentCache.current = DefaultCacheDispatcher; + var abortSet = new Set(); + options = []; + var hints = new Set(); + onError = { + status: 0, + flushScheduled: !1, + fatalError: null, + destination: null, + bundlerConfig: null, + cache: new Map(), + nextChunkId: 0, + pendingChunks: 0, + hints: hints, + abortableTasks: abortSet, + pingedTasks: options, + completedImportChunks: [], + completedHintChunks: [], + completedRegularChunks: [], + completedErrorChunks: [], + writtenSymbols: new Map(), + writtenClientReferences: new Map(), + writtenServerReferences: new Map(), + writtenProviders: new Map(), + writtenObjects: new WeakMap(), + identifierPrefix: "", + identifierCount: 1, + taintCleanupQueue: [], + onError: void 0 === onError ? defaultErrorHandler : onError, + onPostpone: defaultPostponeHandler + }; + onError.pendingChunks++; + model = createTask(onError, model, null, abortSet); + options.push(model); + onError.flushScheduled = null !== onError.destination; + performWork(onError); + if (1 === onError.status) + (onError.status = 2), + destination.onError(onError.fatalError), destination.close(); - else if (2 !== model.status && null === model.destination) { - model.destination = destination; + else if (2 !== onError.status && null === onError.destination) { + onError.destination = destination; try { - flushCompletedChunks(model, destination); + flushCompletedChunks(onError, destination); } catch (error) { - logRecoverableError(model, error), fatalError(model, error); + logRecoverableError(onError, error), fatalError(onError, error); } } }; diff --git a/compiled/facebook-www/ReactServer-prod.modern.js b/compiled/facebook-www/ReactServer-prod.modern.js index e235ca5ac9..3be6c6d720 100644 --- a/compiled/facebook-www/ReactServer-prod.modern.js +++ b/compiled/facebook-www/ReactServer-prod.modern.js @@ -448,4 +448,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactCurrentDispatcher.current.useMemo(create, deps); }; -exports.version = "18.3.0-www-modern-ac3cce8e"; +exports.version = "18.3.0-www-modern-6b2064ea"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 47fe0b5783..ffd5fb5ba9 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -26027,7 +26027,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-modern-e23b30f2"; + var ReactVersion = "18.3.0-www-modern-3e4d88ae"; // Might add PROFILE later.