Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test for recoverable error when new, unrelated Suspense boundaries commit #32436

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Feb 20, 2025

Summary

Found these when working on the Next.js error overlay.

How did you test this change?

const [state, setState] = React.useState(false);
renderSuspense = () => setState(true);

return state ? <Suspense /> : null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new Suspense boundary triggers the error. If we start out with return <Suspense /> no error is triggered.

<Page />
</Suspense>
</ErrorBoundary>
<Sibling />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're triggering an update in the <Sibling> tree long after <ErrorBoundary> committed yet we still get the "switched to client-side rendering" from the <ErrorBoundary> tree.

@react-sizebot
Copy link

react-sizebot commented Feb 20, 2025

Comparing: 70f1d76...b117d40

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 515.71 kB 515.71 kB = 92.09 kB 92.09 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 562.25 kB 562.25 kB = 100.08 kB 100.08 kB
facebook-www/ReactDOM-prod.classic.js = 636.70 kB 636.70 kB = 112.08 kB 112.08 kB
facebook-www/ReactDOM-prod.modern.js = 627.02 kB 627.02 kB = 110.50 kB 110.49 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactFabric-profiling.js +0.21% 383.86 kB 384.68 kB +0.15% 66.11 kB 66.21 kB
react-native/implementations/ReactFabric-prod.js +0.20% 358.62 kB 359.35 kB +0.16% 62.40 kB 62.51 kB
react-native/shims/ReactNativeTypes.js = 8.73 kB 8.57 kB = 2.35 kB 2.28 kB

Generated by 🚫 dangerJS against 0c0218a

@eps1lon eps1lon force-pushed the client-side-rendering-switch-error branch 2 times, most recently from 5ae5713 to 9d1a228 Compare February 20, 2025 19:06
Comment on lines 1178 to 1204
expectErrors(
errors,
[
[
'Switched to client rendering because the server rendering errored:\n\n' +
theError.message,
expectedDigest,
componentStack(['Page', 'Suspense', 'ErrorBoundary', 'App']),
],
[
'Switched to client rendering because the server rendering errored:\n\n' +
theError.message,
expectedDigest,
componentStack(['Page', 'Suspense', 'ErrorBoundary', 'App']),
],
],
[
[
'The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.',
expectedDigest,
],
],
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no errors here since we updated an unrelated tree. That particular error was already handled by committing the error boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants