Unverified Commit 677c04f0 authored by Josh Story's avatar Josh Story Committed by GitHub

update react builtin deps for next channel (#42639)

Updates builtin react to latest release on next channel

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent bccf1861
...@@ -179,11 +179,11 @@ ...@@ -179,11 +179,11 @@
"random-seed": "0.3.0", "random-seed": "0.3.0",
"react": "18.2.0", "react": "18.2.0",
"react-17": "npm:react@17.0.2", "react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-next-28a574ea8-20221027", "react-builtin": "npm:react@18.3.0-next-4bd245e9e-20221104",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2", "react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-next-28a574ea8-20221027", "react-dom-builtin": "npm:react-dom@18.3.0-next-4bd245e9e-20221104",
"react-server-dom-webpack": "18.3.0-next-28a574ea8-20221027", "react-server-dom-webpack": "18.3.0-next-4bd245e9e-20221104",
"react-ssr-prepass": "1.0.8", "react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3", "react-virtualized": "9.22.3",
"relay-compiler": "13.0.2", "relay-compiler": "13.0.2",
......
...@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") { ...@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require('react'); var React = require('react');
var ReactDOM = require('react-dom'); var ReactDOM = require('react-dom');
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
...@@ -3813,7 +3813,7 @@ function pushStartMenuItem(target, props, responseState) { ...@@ -3813,7 +3813,7 @@ function pushStartMenuItem(target, props, responseState) {
return null; return null;
} }
function pushTitle(target, props, responseState, noscriptTagInScope) { function pushTitle(target, props, responseState, insertionMode, noscriptTagInScope) {
{ {
var children = props.children; var children = props.children;
var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children; var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
...@@ -3827,7 +3827,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) { ...@@ -3827,7 +3827,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) {
} }
} }
if ( !noscriptTagInScope && resourcesFromElement('title', props)) { if ( // title is valid in SVG so we avoid resour
insertionMode !== SVG_MODE && !noscriptTagInScope && resourcesFromElement('title', props)) {
// We have converted this link exclusively to a resource and no longer // We have converted this link exclusively to a resource and no longer
// need to emit it // need to emit it
return null; return null;
...@@ -4178,7 +4179,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC ...@@ -4178,7 +4179,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC
return pushStartMenuItem(target, props, responseState); return pushStartMenuItem(target, props, responseState);
case 'title': case 'title':
return pushTitle(target, props, responseState, formatContext.noscriptTagInScope) ; return pushTitle(target, props, responseState, formatContext.insertionMode, formatContext.noscriptTagInScope) ;
case 'link': case 'link':
return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope); return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);
...@@ -6603,6 +6604,9 @@ function clz32Fallback(x) { ...@@ -6603,6 +6604,9 @@ function clz32Fallback(x) {
// changes to one module should be reflected in the others. // changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable" // TODO: Rename this module and the corresponding Fiber one to "Thenable"
// instead of "Wakeable". Or some other more appropriate name. // instead of "Wakeable". Or some other more appropriate name.
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
// detect this is caught by userspace, we'll log a warning in development.
var SuspenseException = new Error("Suspense Exception: This is not a real error! It's an implementation " + 'detail of `use` to interrupt the current render. You must either ' + 'rethrow it immediately, or move the `use` call outside of the ' + '`try/catch` block. Capturing without rethrowing will lead to ' + 'unexpected behavior.\n\n' + 'To handle async errors, wrap your component in an error boundary, or ' + "call the promise's `.catch` method and pass the result to `use`");
function createThenableState() { function createThenableState() {
// The ThenableState is created the first time a component suspends. If it // The ThenableState is created the first time a component suspends. If it
// suspends again, we'll reuse the same state. // suspends again, we'll reuse the same state.
...@@ -6663,19 +6667,51 @@ function trackUsedThenable(thenableState, thenable, index) { ...@@ -6663,19 +6667,51 @@ function trackUsedThenable(thenableState, thenable, index) {
rejectedThenable.status = 'rejected'; rejectedThenable.status = 'rejected';
rejectedThenable.reason = error; 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;
throw rejectedThenable.reason;
}
}
} // Suspend. } // Suspend.
// TODO: Throwing here is an implementation detail that allows us to //
// unwind the call stack. But we shouldn't allow it to leak into // Throwing here is an implementation detail that allows us to unwind the
// userspace. Throw an opaque placeholder value instead of the // call stack. But we shouldn't allow it to leak into userspace. Throw an
// actual thenable. If it doesn't get captured by the work loop, log // opaque placeholder value instead of the actual thenable. If it doesn't
// a warning, because that means something in userspace must have // get captured by the work loop, log a warning, because that means
// caught it. // something in userspace must have caught it.
throw thenable; suspendedThenable = thenable;
throw SuspenseException;
} }
} }
} // This is used to track the actual thenable that suspended so it can be
// passed to the rest of the Suspense implementation — which, for historical
// reasons, expects to receive a thenable.
var suspendedThenable = null;
function getSuspendedThenable() {
// This is called right after `use` suspends by throwing an exception. `use`
// throws an opaque value instead of the thenable itself so that it can't be
// caught in userspace. Then the work loop accesses the actual thenable using
// this function.
if (suspendedThenable === null) {
throw new Error('Expected a suspended thenable. This is a bug in React. Please file ' + 'an issue.');
}
var thenable = suspendedThenable;
suspendedThenable = null;
return thenable;
} }
/** /**
...@@ -8248,12 +8284,19 @@ function renderNode(request, task, node) { ...@@ -8248,12 +8284,19 @@ function renderNode(request, task, node) {
try { try {
return renderNodeDestructive(request, task, null, node); return renderNodeDestructive(request, task, null, node);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
var wakeable = x;
var thenableState = getThenableStateAfterSuspending(); var thenableState = getThenableStateAfterSuspending();
spawnNewSuspendedTask(request, task, thenableState, x); // Restore the context. We assume that this will be restored by the inner spawnNewSuspendedTask(request, task, thenableState, wakeable); // Restore the context. We assume that this will be restored by the inner
// functions in case nothing throws so we don't use "finally" here. // functions in case nothing throws so we don't use "finally" here.
task.blockedSegment.formatContext = previousFormatContext; task.blockedSegment.formatContext = previousFormatContext;
...@@ -8531,8 +8574,14 @@ function retryTask(request, task) { ...@@ -8531,8 +8574,14 @@ function retryTask(request, task) {
task.abortSet.delete(task); task.abortSet.delete(task);
segment.status = COMPLETED; segment.status = COMPLETED;
finishedTask(request, task.blockedBoundary, segment); finishedTask(request, task.blockedBoundary, segment);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
// Something suspended again, let's pick it back up later. // Something suspended again, let's pick it back up later.
......
...@@ -18,7 +18,7 @@ var React = require('react'); ...@@ -18,7 +18,7 @@ var React = require('react');
var ReactDOM = require('react-dom'); var ReactDOM = require('react-dom');
var stream = require('stream'); var stream = require('stream');
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
...@@ -3814,7 +3814,7 @@ function pushStartMenuItem(target, props, responseState) { ...@@ -3814,7 +3814,7 @@ function pushStartMenuItem(target, props, responseState) {
return null; return null;
} }
function pushTitle(target, props, responseState, noscriptTagInScope) { function pushTitle(target, props, responseState, insertionMode, noscriptTagInScope) {
{ {
var children = props.children; var children = props.children;
var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children; var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
...@@ -3828,7 +3828,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) { ...@@ -3828,7 +3828,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) {
} }
} }
if ( !noscriptTagInScope && resourcesFromElement('title', props)) { if ( // title is valid in SVG so we avoid resour
insertionMode !== SVG_MODE && !noscriptTagInScope && resourcesFromElement('title', props)) {
// We have converted this link exclusively to a resource and no longer // We have converted this link exclusively to a resource and no longer
// need to emit it // need to emit it
return null; return null;
...@@ -4179,7 +4180,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC ...@@ -4179,7 +4180,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC
return pushStartMenuItem(target, props, responseState); return pushStartMenuItem(target, props, responseState);
case 'title': case 'title':
return pushTitle(target, props, responseState, formatContext.noscriptTagInScope) ; return pushTitle(target, props, responseState, formatContext.insertionMode, formatContext.noscriptTagInScope) ;
case 'link': case 'link':
return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope); return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);
...@@ -6604,6 +6605,9 @@ function clz32Fallback(x) { ...@@ -6604,6 +6605,9 @@ function clz32Fallback(x) {
// changes to one module should be reflected in the others. // changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable" // TODO: Rename this module and the corresponding Fiber one to "Thenable"
// instead of "Wakeable". Or some other more appropriate name. // instead of "Wakeable". Or some other more appropriate name.
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
// detect this is caught by userspace, we'll log a warning in development.
var SuspenseException = new Error("Suspense Exception: This is not a real error! It's an implementation " + 'detail of `use` to interrupt the current render. You must either ' + 'rethrow it immediately, or move the `use` call outside of the ' + '`try/catch` block. Capturing without rethrowing will lead to ' + 'unexpected behavior.\n\n' + 'To handle async errors, wrap your component in an error boundary, or ' + "call the promise's `.catch` method and pass the result to `use`");
function createThenableState() { function createThenableState() {
// The ThenableState is created the first time a component suspends. If it // The ThenableState is created the first time a component suspends. If it
// suspends again, we'll reuse the same state. // suspends again, we'll reuse the same state.
...@@ -6664,19 +6668,51 @@ function trackUsedThenable(thenableState, thenable, index) { ...@@ -6664,19 +6668,51 @@ function trackUsedThenable(thenableState, thenable, index) {
rejectedThenable.status = 'rejected'; rejectedThenable.status = 'rejected';
rejectedThenable.reason = error; 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;
throw rejectedThenable.reason;
}
}
} // Suspend. } // Suspend.
// TODO: Throwing here is an implementation detail that allows us to //
// unwind the call stack. But we shouldn't allow it to leak into // Throwing here is an implementation detail that allows us to unwind the
// userspace. Throw an opaque placeholder value instead of the // call stack. But we shouldn't allow it to leak into userspace. Throw an
// actual thenable. If it doesn't get captured by the work loop, log // opaque placeholder value instead of the actual thenable. If it doesn't
// a warning, because that means something in userspace must have // get captured by the work loop, log a warning, because that means
// caught it. // something in userspace must have caught it.
throw thenable; suspendedThenable = thenable;
throw SuspenseException;
} }
} }
} // This is used to track the actual thenable that suspended so it can be
// passed to the rest of the Suspense implementation — which, for historical
// reasons, expects to receive a thenable.
var suspendedThenable = null;
function getSuspendedThenable() {
// This is called right after `use` suspends by throwing an exception. `use`
// throws an opaque value instead of the thenable itself so that it can't be
// caught in userspace. Then the work loop accesses the actual thenable using
// this function.
if (suspendedThenable === null) {
throw new Error('Expected a suspended thenable. This is a bug in React. Please file ' + 'an issue.');
}
var thenable = suspendedThenable;
suspendedThenable = null;
return thenable;
} }
/** /**
...@@ -8249,12 +8285,19 @@ function renderNode(request, task, node) { ...@@ -8249,12 +8285,19 @@ function renderNode(request, task, node) {
try { try {
return renderNodeDestructive(request, task, null, node); return renderNodeDestructive(request, task, null, node);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
var wakeable = x;
var thenableState = getThenableStateAfterSuspending(); var thenableState = getThenableStateAfterSuspending();
spawnNewSuspendedTask(request, task, thenableState, x); // Restore the context. We assume that this will be restored by the inner spawnNewSuspendedTask(request, task, thenableState, wakeable); // Restore the context. We assume that this will be restored by the inner
// functions in case nothing throws so we don't use "finally" here. // functions in case nothing throws so we don't use "finally" here.
task.blockedSegment.formatContext = previousFormatContext; task.blockedSegment.formatContext = previousFormatContext;
...@@ -8532,8 +8575,14 @@ function retryTask(request, task) { ...@@ -8532,8 +8575,14 @@ function retryTask(request, task) {
task.abortSet.delete(task); task.abortSet.delete(task);
segment.status = COMPLETED; segment.status = COMPLETED;
finishedTask(request, task.blockedBoundary, segment); finishedTask(request, task.blockedBoundary, segment);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
// Something suspended again, let's pick it back up later. // Something suspended again, let's pick it back up later.
......
...@@ -14,7 +14,7 @@ if (process.env.NODE_ENV !== "production") { ...@@ -14,7 +14,7 @@ if (process.env.NODE_ENV !== "production") {
(function() { (function() {
'use strict'; 'use strict';
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
var Internals = { var Internals = {
usingClientEntryPoint: false, usingClientEntryPoint: false,
......
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
'use strict';var b={usingClientEntryPoint:!1,Events:null,Dispatcher:{current:null}};function d(a){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)e+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b; 'use strict';var b={usingClientEntryPoint:!1,Events:null,Dispatcher:{current:null}};function d(a){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)e+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b;
exports.createPortal=function(){throw Error(d(448));};exports.flushSync=function(){throw Error(d(449));};exports.preinit=function(){var a=b.Dispatcher.current;a&&a.preinit.apply(this,arguments)};exports.preload=function(){var a=b.Dispatcher.current;a&&a.preload.apply(this,arguments)};exports.version="18.3.0-next-28a574ea8-20221027"; exports.createPortal=function(){throw Error(d(448));};exports.flushSync=function(){throw Error(d(449));};exports.preinit=function(){var a=b.Dispatcher.current;a&&a.preinit.apply(this,arguments)};exports.preload=function(){var a=b.Dispatcher.current;a&&a.preload.apply(this,arguments)};exports.version="18.3.0-next-4bd245e9e-20221104";
...@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") { ...@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require('react'); var React = require('react');
var ReactDOM = require('react-dom'); var ReactDOM = require('react-dom');
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
...@@ -3889,7 +3889,7 @@ function pushStartMenuItem(target, props, responseState) { ...@@ -3889,7 +3889,7 @@ function pushStartMenuItem(target, props, responseState) {
return null; return null;
} }
function pushTitle(target, props, responseState, noscriptTagInScope) { function pushTitle(target, props, responseState, insertionMode, noscriptTagInScope) {
{ {
var children = props.children; var children = props.children;
var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children; var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
...@@ -3903,7 +3903,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) { ...@@ -3903,7 +3903,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) {
} }
} }
if ( !noscriptTagInScope && resourcesFromElement('title', props)) { if ( // title is valid in SVG so we avoid resour
insertionMode !== SVG_MODE && !noscriptTagInScope && resourcesFromElement('title', props)) {
// We have converted this link exclusively to a resource and no longer // We have converted this link exclusively to a resource and no longer
// need to emit it // need to emit it
return null; return null;
...@@ -4254,7 +4255,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC ...@@ -4254,7 +4255,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC
return pushStartMenuItem(target, props, responseState); return pushStartMenuItem(target, props, responseState);
case 'title': case 'title':
return pushTitle(target, props, responseState, formatContext.noscriptTagInScope) ; return pushTitle(target, props, responseState, formatContext.insertionMode, formatContext.noscriptTagInScope) ;
case 'link': case 'link':
return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope); return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);
...@@ -6603,6 +6604,9 @@ function clz32Fallback(x) { ...@@ -6603,6 +6604,9 @@ function clz32Fallback(x) {
// changes to one module should be reflected in the others. // changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable" // TODO: Rename this module and the corresponding Fiber one to "Thenable"
// instead of "Wakeable". Or some other more appropriate name. // instead of "Wakeable". Or some other more appropriate name.
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
// detect this is caught by userspace, we'll log a warning in development.
var SuspenseException = new Error("Suspense Exception: This is not a real error! It's an implementation " + 'detail of `use` to interrupt the current render. You must either ' + 'rethrow it immediately, or move the `use` call outside of the ' + '`try/catch` block. Capturing without rethrowing will lead to ' + 'unexpected behavior.\n\n' + 'To handle async errors, wrap your component in an error boundary, or ' + "call the promise's `.catch` method and pass the result to `use`");
function createThenableState() { function createThenableState() {
// The ThenableState is created the first time a component suspends. If it // The ThenableState is created the first time a component suspends. If it
// suspends again, we'll reuse the same state. // suspends again, we'll reuse the same state.
...@@ -6663,19 +6667,51 @@ function trackUsedThenable(thenableState, thenable, index) { ...@@ -6663,19 +6667,51 @@ function trackUsedThenable(thenableState, thenable, index) {
rejectedThenable.status = 'rejected'; rejectedThenable.status = 'rejected';
rejectedThenable.reason = error; 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;
throw rejectedThenable.reason;
}
}
} // Suspend. } // Suspend.
// TODO: Throwing here is an implementation detail that allows us to //
// unwind the call stack. But we shouldn't allow it to leak into // Throwing here is an implementation detail that allows us to unwind the
// userspace. Throw an opaque placeholder value instead of the // call stack. But we shouldn't allow it to leak into userspace. Throw an
// actual thenable. If it doesn't get captured by the work loop, log // opaque placeholder value instead of the actual thenable. If it doesn't
// a warning, because that means something in userspace must have // get captured by the work loop, log a warning, because that means
// caught it. // something in userspace must have caught it.
throw thenable; suspendedThenable = thenable;
throw SuspenseException;
} }
} }
} // This is used to track the actual thenable that suspended so it can be
// passed to the rest of the Suspense implementation — which, for historical
// reasons, expects to receive a thenable.
var suspendedThenable = null;
function getSuspendedThenable() {
// This is called right after `use` suspends by throwing an exception. `use`
// throws an opaque value instead of the thenable itself so that it can't be
// caught in userspace. Then the work loop accesses the actual thenable using
// this function.
if (suspendedThenable === null) {
throw new Error('Expected a suspended thenable. This is a bug in React. Please file ' + 'an issue.');
}
var thenable = suspendedThenable;
suspendedThenable = null;
return thenable;
} }
/** /**
...@@ -8248,12 +8284,19 @@ function renderNode(request, task, node) { ...@@ -8248,12 +8284,19 @@ function renderNode(request, task, node) {
try { try {
return renderNodeDestructive(request, task, null, node); return renderNodeDestructive(request, task, null, node);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
var wakeable = x;
var thenableState = getThenableStateAfterSuspending(); var thenableState = getThenableStateAfterSuspending();
spawnNewSuspendedTask(request, task, thenableState, x); // Restore the context. We assume that this will be restored by the inner spawnNewSuspendedTask(request, task, thenableState, wakeable); // Restore the context. We assume that this will be restored by the inner
// functions in case nothing throws so we don't use "finally" here. // functions in case nothing throws so we don't use "finally" here.
task.blockedSegment.formatContext = previousFormatContext; task.blockedSegment.formatContext = previousFormatContext;
...@@ -8531,8 +8574,14 @@ function retryTask(request, task) { ...@@ -8531,8 +8574,14 @@ function retryTask(request, task) {
task.abortSet.delete(task); task.abortSet.delete(task);
segment.status = COMPLETED; segment.status = COMPLETED;
finishedTask(request, task.blockedBoundary, segment); finishedTask(request, task.blockedBoundary, segment);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
// Something suspended again, let's pick it back up later. // Something suspended again, let's pick it back up later.
......
...@@ -19,7 +19,7 @@ var util = require('util'); ...@@ -19,7 +19,7 @@ var util = require('util');
var async_hooks = require('async_hooks'); var async_hooks = require('async_hooks');
var ReactDOM = require('react-dom'); var ReactDOM = require('react-dom');
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
...@@ -3953,7 +3953,7 @@ function pushStartMenuItem(target, props, responseState) { ...@@ -3953,7 +3953,7 @@ function pushStartMenuItem(target, props, responseState) {
return null; return null;
} }
function pushTitle(target, props, responseState, noscriptTagInScope) { function pushTitle(target, props, responseState, insertionMode, noscriptTagInScope) {
{ {
var children = props.children; var children = props.children;
var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children; var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
...@@ -3967,7 +3967,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) { ...@@ -3967,7 +3967,8 @@ function pushTitle(target, props, responseState, noscriptTagInScope) {
} }
} }
if ( !noscriptTagInScope && resourcesFromElement('title', props)) { if ( // title is valid in SVG so we avoid resour
insertionMode !== SVG_MODE && !noscriptTagInScope && resourcesFromElement('title', props)) {
// We have converted this link exclusively to a resource and no longer // We have converted this link exclusively to a resource and no longer
// need to emit it // need to emit it
return null; return null;
...@@ -4318,7 +4319,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC ...@@ -4318,7 +4319,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC
return pushStartMenuItem(target, props, responseState); return pushStartMenuItem(target, props, responseState);
case 'title': case 'title':
return pushTitle(target, props, responseState, formatContext.noscriptTagInScope) ; return pushTitle(target, props, responseState, formatContext.insertionMode, formatContext.noscriptTagInScope) ;
case 'link': case 'link':
return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope); return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);
...@@ -6667,6 +6668,9 @@ function clz32Fallback(x) { ...@@ -6667,6 +6668,9 @@ function clz32Fallback(x) {
// changes to one module should be reflected in the others. // changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable" // TODO: Rename this module and the corresponding Fiber one to "Thenable"
// instead of "Wakeable". Or some other more appropriate name. // instead of "Wakeable". Or some other more appropriate name.
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
// detect this is caught by userspace, we'll log a warning in development.
var SuspenseException = new Error("Suspense Exception: This is not a real error! It's an implementation " + 'detail of `use` to interrupt the current render. You must either ' + 'rethrow it immediately, or move the `use` call outside of the ' + '`try/catch` block. Capturing without rethrowing will lead to ' + 'unexpected behavior.\n\n' + 'To handle async errors, wrap your component in an error boundary, or ' + "call the promise's `.catch` method and pass the result to `use`");
function createThenableState() { function createThenableState() {
// The ThenableState is created the first time a component suspends. If it // The ThenableState is created the first time a component suspends. If it
// suspends again, we'll reuse the same state. // suspends again, we'll reuse the same state.
...@@ -6727,19 +6731,51 @@ function trackUsedThenable(thenableState, thenable, index) { ...@@ -6727,19 +6731,51 @@ function trackUsedThenable(thenableState, thenable, index) {
rejectedThenable.status = 'rejected'; rejectedThenable.status = 'rejected';
rejectedThenable.reason = error; 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;
throw rejectedThenable.reason;
}
}
} // Suspend. } // Suspend.
// TODO: Throwing here is an implementation detail that allows us to //
// unwind the call stack. But we shouldn't allow it to leak into // Throwing here is an implementation detail that allows us to unwind the
// userspace. Throw an opaque placeholder value instead of the // call stack. But we shouldn't allow it to leak into userspace. Throw an
// actual thenable. If it doesn't get captured by the work loop, log // opaque placeholder value instead of the actual thenable. If it doesn't
// a warning, because that means something in userspace must have // get captured by the work loop, log a warning, because that means
// caught it. // something in userspace must have caught it.
throw thenable; suspendedThenable = thenable;
throw SuspenseException;
} }
} }
} // This is used to track the actual thenable that suspended so it can be
// passed to the rest of the Suspense implementation — which, for historical
// reasons, expects to receive a thenable.
var suspendedThenable = null;
function getSuspendedThenable() {
// This is called right after `use` suspends by throwing an exception. `use`
// throws an opaque value instead of the thenable itself so that it can't be
// caught in userspace. Then the work loop accesses the actual thenable using
// this function.
if (suspendedThenable === null) {
throw new Error('Expected a suspended thenable. This is a bug in React. Please file ' + 'an issue.');
}
var thenable = suspendedThenable;
suspendedThenable = null;
return thenable;
} }
/** /**
...@@ -8312,12 +8348,19 @@ function renderNode(request, task, node) { ...@@ -8312,12 +8348,19 @@ function renderNode(request, task, node) {
try { try {
return renderNodeDestructive(request, task, null, node); return renderNodeDestructive(request, task, null, node);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
var wakeable = x;
var thenableState = getThenableStateAfterSuspending(); var thenableState = getThenableStateAfterSuspending();
spawnNewSuspendedTask(request, task, thenableState, x); // Restore the context. We assume that this will be restored by the inner spawnNewSuspendedTask(request, task, thenableState, wakeable); // Restore the context. We assume that this will be restored by the inner
// functions in case nothing throws so we don't use "finally" here. // functions in case nothing throws so we don't use "finally" here.
task.blockedSegment.formatContext = previousFormatContext; task.blockedSegment.formatContext = previousFormatContext;
...@@ -8595,8 +8638,14 @@ function retryTask(request, task) { ...@@ -8595,8 +8638,14 @@ function retryTask(request, task) {
task.abortSet.delete(task); task.abortSet.delete(task);
segment.status = COMPLETED; segment.status = COMPLETED;
finishedTask(request, task.blockedBoundary, segment); finishedTask(request, task.blockedBoundary, segment);
} catch (x) { } catch (thrownValue) {
resetHooksState(); resetHooksState();
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; // $FlowFixMe[method-unbinding]
if (typeof x === 'object' && x !== null && typeof x.then === 'function') { if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
// Something suspended again, let's pick it back up later. // Something suspended again, let's pick it back up later.
......
{ {
"name": "react-dom", "name": "react-dom",
"version": "18.3.0-next-28a574ea8-20221027", "version": "18.3.0-next-4bd245e9e-20221104",
"description": "React package for working with the DOM.", "description": "React package for working with the DOM.",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
"homepage": "https://reactjs.org/", "homepage": "https://reactjs.org/",
"dependencies": { "dependencies": {
"loose-envify": "^1.1.0", "loose-envify": "^1.1.0",
"scheduler": "0.24.0-next-28a574ea8-20221027" "scheduler": "0.24.0-next-4bd245e9e-20221104"
}, },
"peerDependencies": { "peerDependencies": {
"react": "18.3.0-next-28a574ea8-20221027" "react": "18.3.0-next-4bd245e9e-20221104"
}, },
"files": [ "files": [
"LICENSE", "LICENSE",
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
"./server-rendering-stub": "./server-rendering-stub.js", "./server-rendering-stub": "./server-rendering-stub.js",
"./profiling": "./profiling.js", "./profiling": "./profiling.js",
"./test-utils": "./test-utils.js", "./test-utils": "./test-utils.js",
"./unstable_server-external-runtime": "./unstable_server-external-runtime.js",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"browser": { "browser": {
......
...@@ -23,7 +23,7 @@ if ( ...@@ -23,7 +23,7 @@ if (
) { ) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
} }
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
// ATTENTION // ATTENTION
// When adding new symbols to this file, // When adding new symbols to this file,
......
...@@ -27,4 +27,4 @@ exports.createServerContext=function(a,b){var d=!0;if(!Z[a]){d=!1;var c={$$typeo ...@@ -27,4 +27,4 @@ exports.createServerContext=function(a,b){var d=!0;if(!Z[a]){d=!1;var c={$$typeo
exports.isValidElement=P;exports.lazy=function(a){return{$$typeof:z,_payload:{_status:-1,_result:a},_init:ba}};exports.memo=function(a,b){return{$$typeof:y,type:a,compare:void 0===b?null:b}};exports.startTransition=function(a){var b=X.transition;X.transition={};try{a()}finally{X.transition=b}};exports.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.");};exports.unstable_useCacheRefresh=function(){return W.current.useCacheRefresh()};exports.use=function(a){return W.current.use(a)}; exports.isValidElement=P;exports.lazy=function(a){return{$$typeof:z,_payload:{_status:-1,_result:a},_init:ba}};exports.memo=function(a,b){return{$$typeof:y,type:a,compare:void 0===b?null:b}};exports.startTransition=function(a){var b=X.transition;X.transition={};try{a()}finally{X.transition=b}};exports.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.");};exports.unstable_useCacheRefresh=function(){return W.current.useCacheRefresh()};exports.use=function(a){return W.current.use(a)};
exports.useCallback=function(a,b){return W.current.useCallback(a,b)};exports.useContext=function(a){return W.current.useContext(a)};exports.useDebugValue=function(){};exports.useDeferredValue=function(a){return W.current.useDeferredValue(a)};exports.useEffect=function(a,b){return W.current.useEffect(a,b)};exports.useId=function(){return W.current.useId()};exports.useImperativeHandle=function(a,b,d){return W.current.useImperativeHandle(a,b,d)}; exports.useCallback=function(a,b){return W.current.useCallback(a,b)};exports.useContext=function(a){return W.current.useContext(a)};exports.useDebugValue=function(){};exports.useDeferredValue=function(a){return W.current.useDeferredValue(a)};exports.useEffect=function(a,b){return W.current.useEffect(a,b)};exports.useId=function(){return W.current.useId()};exports.useImperativeHandle=function(a,b,d){return W.current.useImperativeHandle(a,b,d)};
exports.useInsertionEffect=function(a,b){return W.current.useInsertionEffect(a,b)};exports.useLayoutEffect=function(a,b){return W.current.useLayoutEffect(a,b)};exports.useMemo=function(a,b){return W.current.useMemo(a,b)};exports.useReducer=function(a,b,d){return W.current.useReducer(a,b,d)};exports.useRef=function(a){return W.current.useRef(a)};exports.useState=function(a){return W.current.useState(a)};exports.useSyncExternalStore=function(a,b,d){return W.current.useSyncExternalStore(a,b,d)}; exports.useInsertionEffect=function(a,b){return W.current.useInsertionEffect(a,b)};exports.useLayoutEffect=function(a,b){return W.current.useLayoutEffect(a,b)};exports.useMemo=function(a,b){return W.current.useMemo(a,b)};exports.useReducer=function(a,b,d){return W.current.useReducer(a,b,d)};exports.useRef=function(a){return W.current.useRef(a)};exports.useState=function(a){return W.current.useState(a)};exports.useSyncExternalStore=function(a,b,d){return W.current.useSyncExternalStore(a,b,d)};
exports.useTransition=function(){return W.current.useTransition()};exports.version="18.3.0-next-28a574ea8-20221027"; exports.useTransition=function(){return W.current.useTransition()};exports.version="18.3.0-next-4bd245e9e-20221104";
...@@ -303,7 +303,7 @@ function generateCacheKey(request) { ...@@ -303,7 +303,7 @@ function generateCacheKey(request) {
} }
} }
var ReactVersion = '18.3.0-next-28a574ea8-20221027'; var ReactVersion = '18.3.0-next-4bd245e9e-20221104';
// ATTENTION // ATTENTION
// When adding new symbols to this file, // When adding new symbols to this file,
......
...@@ -26,4 +26,4 @@ exports.cloneElement=function(a,b,d){if(null===a||void 0===a)throw Error(F(267,a ...@@ -26,4 +26,4 @@ exports.cloneElement=function(a,b,d){if(null===a||void 0===a)throw Error(F(267,a
key:e,ref:f,props:c,_owner:g}};exports.createElement=function(a,b,d){var c,e={},f=null,g=null;if(null!=b)for(c in void 0!==b.ref&&(g=b.ref),void 0!==b.key&&(f=""+b.key),b)N.call(b,c)&&!P.hasOwnProperty(c)&&(e[c]=b[c]);var h=arguments.length-2;if(1===h)e.children=d;else if(1<h){for(var k=Array(h),l=0;l<h;l++)k[l]=arguments[l+2];e.children=k}if(a&&a.defaultProps)for(c in h=a.defaultProps,h)void 0===e[c]&&(e[c]=h[c]);return{$$typeof:t,type:a,key:f,ref:g,props:e,_owner:O.current}};exports.createRef=function(){return{current:null}}; key:e,ref:f,props:c,_owner:g}};exports.createElement=function(a,b,d){var c,e={},f=null,g=null;if(null!=b)for(c in void 0!==b.ref&&(g=b.ref),void 0!==b.key&&(f=""+b.key),b)N.call(b,c)&&!P.hasOwnProperty(c)&&(e[c]=b[c]);var h=arguments.length-2;if(1===h)e.children=d;else if(1<h){for(var k=Array(h),l=0;l<h;l++)k[l]=arguments[l+2];e.children=k}if(a&&a.defaultProps)for(c in h=a.defaultProps,h)void 0===e[c]&&(e[c]=h[c]);return{$$typeof:t,type:a,key:f,ref:g,props:e,_owner:O.current}};exports.createRef=function(){return{current:null}};
exports.createServerContext=function(a,b){var d=!0;if(!Z[a]){d=!1;var c={$$typeof:z,_currentValue:b,_currentValue2:b,_defaultValue:b,_threadCount:0,Provider:null,Consumer:null,_globalName:a};c.Provider={$$typeof:y,_context:c};Z[a]=c}c=Z[a];if(c._defaultValue===D)c._defaultValue=b,c._currentValue===D&&(c._currentValue=b),c._currentValue2===D&&(c._currentValue2=b);else if(d)throw Error(F(429,a));return c};exports.forwardRef=function(a){return{$$typeof:A,render:a}};exports.isValidElement=Q; exports.createServerContext=function(a,b){var d=!0;if(!Z[a]){d=!1;var c={$$typeof:z,_currentValue:b,_currentValue2:b,_defaultValue:b,_threadCount:0,Provider:null,Consumer:null,_globalName:a};c.Provider={$$typeof:y,_context:c};Z[a]=c}c=Z[a];if(c._defaultValue===D)c._defaultValue=b,c._currentValue===D&&(c._currentValue=b),c._currentValue2===D&&(c._currentValue2=b);else if(d)throw Error(F(429,a));return c};exports.forwardRef=function(a){return{$$typeof:A,render:a}};exports.isValidElement=Q;
exports.lazy=function(a){return{$$typeof:aa,_payload:{_status:-1,_result:a},_init:da}};exports.memo=function(a,b){return{$$typeof:C,type:a,compare:void 0===b?null:b}};exports.startTransition=function(a){var b=X.transition;X.transition={};try{a()}finally{X.transition=b}};exports.use=function(a){return W.current.use(a)};exports.useCallback=function(a,b){return W.current.useCallback(a,b)};exports.useContext=function(a){return W.current.useContext(a)};exports.useDebugValue=function(){}; exports.lazy=function(a){return{$$typeof:aa,_payload:{_status:-1,_result:a},_init:da}};exports.memo=function(a,b){return{$$typeof:C,type:a,compare:void 0===b?null:b}};exports.startTransition=function(a){var b=X.transition;X.transition={};try{a()}finally{X.transition=b}};exports.use=function(a){return W.current.use(a)};exports.useCallback=function(a,b){return W.current.useCallback(a,b)};exports.useContext=function(a){return W.current.useContext(a)};exports.useDebugValue=function(){};
exports.useId=function(){return W.current.useId()};exports.useMemo=function(a,b){return W.current.useMemo(a,b)};exports.version="18.3.0-next-28a574ea8-20221027"; exports.useId=function(){return W.current.useId()};exports.useMemo=function(a,b){return W.current.useMemo(a,b)};exports.version="18.3.0-next-4bd245e9e-20221104";
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"keywords": [ "keywords": [
"react" "react"
], ],
"version": "18.3.0-next-28a574ea8-20221027", "version": "18.3.0-next-4bd245e9e-20221104",
"homepage": "https://reactjs.org/", "homepage": "https://reactjs.org/",
"bugs": "https://github.com/facebook/react/issues", "bugs": "https://github.com/facebook/react/issues",
"license": "MIT", "license": "MIT",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment