Skip to content

Commit

Permalink
update react builtin deps for next channel (#42639)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
gnoff committed Nov 8, 2022
1 parent bccf186 commit 677c04f
Show file tree
Hide file tree
Showing 22 changed files with 1,943 additions and 1,397 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -179,11 +179,11 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"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-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-next-28a574ea8-20221027",
"react-server-dom-webpack": "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-4bd245e9e-20221104",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand Down
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require('react');
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;

Expand Down Expand Up @@ -3813,7 +3813,7 @@ function pushStartMenuItem(target, props, responseState) {
return null;
}

function pushTitle(target, props, responseState, noscriptTagInScope) {
function pushTitle(target, props, responseState, insertionMode, noscriptTagInScope) {
{
var children = props.children;
var childForValidation = Array.isArray(children) && children.length < 2 ? children[0] || null : children;
Expand All @@ -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
// need to emit it
return null;
Expand Down Expand Up @@ -4178,7 +4179,7 @@ function pushStartInstance(target, preamble, type, props, responseState, formatC
return pushStartMenuItem(target, props, responseState);

case 'title':
return pushTitle(target, props, responseState, formatContext.noscriptTagInScope) ;
return pushTitle(target, props, responseState, formatContext.insertionMode, formatContext.noscriptTagInScope) ;

case 'link':
return pushLink(target, props, responseState, textEmbedded, formatContext.noscriptTagInScope);
Expand Down Expand Up @@ -6603,6 +6604,9 @@ function clz32Fallback(x) {
// changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable"
// 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() {
// The ThenableState is created the first time a component suspends. If it
// suspends again, we'll reuse the same state.
Expand Down Expand Up @@ -6663,19 +6667,51 @@ function trackUsedThenable(thenableState, thenable, index) {
rejectedThenable.status = 'rejected';
rejectedThenable.reason = error;
}
});
}); // Check one more time in case the thenable resolved synchronously

switch (thenable.status) {
case 'fulfilled':
{
var fulfilledThenable = thenable;
return fulfilledThenable.value;
}

case 'rejected':
{
var rejectedThenable = thenable;
throw rejectedThenable.reason;
}
}
} // 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
// userspace. Throw an opaque placeholder value instead of the
// actual thenable. If it doesn't get captured by the work loop, log
// a warning, because that means something in userspace must have
// caught it.
//
// Throwing here is an implementation detail that allows us to unwind the
// call stack. But we shouldn't allow it to leak into userspace. Throw an
// opaque placeholder value instead of the actual thenable. If it doesn't
// get captured by the work loop, log a warning, because that means
// 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;
}

/**
Expand Down Expand Up @@ -8248,12 +8284,19 @@ function renderNode(request, task, node) {

try {
return renderNodeDestructive(request, task, null, node);
} catch (x) {
} catch (thrownValue) {
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') {
var wakeable = x;
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.

task.blockedSegment.formatContext = previousFormatContext;
Expand Down Expand Up @@ -8531,8 +8574,14 @@ function retryTask(request, task) {
task.abortSet.delete(task);
segment.status = COMPLETED;
finishedTask(request, task.blockedBoundary, segment);
} catch (x) {
} catch (thrownValue) {
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') {
// Something suspended again, let's pick it back up later.
Expand Down

0 comments on commit 677c04f

Please sign in to comment.