Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Aug 1, 2024

Found by working in vercel/next.js#67861

When you throw an error during a render that was triggered from an Effect, React should treat that the same as if it would've happened during the initial render. However, when you have an error boundary that just passes the error through by returning children like nothing happened (like rethrowing but for error boundaries), React will retry the error infinitely.

React should just stop after a retry like it normally does.

In our tests we hit the "maximum update-depth exceeded" but in Codesandbox and Next.js it just renders infinitely.

Copy link

vercel bot commented Aug 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 6:50pm

@react-sizebot
Copy link

Comparing: 06d0b89...a5a8cf7

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.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 500.37 kB 500.37 kB = 89.80 kB 89.80 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 = 507.50 kB 507.50 kB = 90.96 kB 90.96 kB
facebook-www/ReactDOM-prod.classic.js = 595.40 kB 595.40 kB = 105.60 kB 105.60 kB
facebook-www/ReactDOM-prod.modern.js = 571.70 kB 571.70 kB = 101.80 kB 101.80 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against a756545

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Aug 1, 2024

This is not actually a bug in a way. It's expected behavior. It's considered an infinite loop to render original children from an error boundary since it'll just render the same thing again. Like we can't forever just treat any new error that happens as if it's a rethrow after having recovered once.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Aug 2, 2024

Then we have a bug when we throw during the initial render since that doesn't infinitely render.

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.

4 participants