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

[Fiber] Mark error boundaries and commit phases when an error is thrown #31876

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sebmarkbage
Copy link
Collaborator

This tracks commit phase errors and marks the component that errored as red. These also get the errors attached to the entry.

Screenshot 2024-12-20 at 2 40 14 PM

In the render phase I just mark the Error Boundary that caught the error. We don't have access to the actual error since it's locked behind closures in the update queue. We could probably expose that someway.

Screenshot 2024-12-20 at 1 49 05 PM

Follow ups:

Since the Error Boundary doesn't commit its attempted render, we don't log those. If we did then maybe we should just mark the errored component like I do for the commit phase. We could potentially walk the list of errors and log the captured fibers and just log their entries as children.

We could also potentially walk the uncommitted Fiber tree by stashing it somewhere or even getting it from the alternate. This could be done on Suspense boundaries too to track failed hydrations.

These are the only ones marked with PerformedWork atm anyway.

This lets us customize the logging for each branch.
Ideally we'd be able to mark the component that errored but we don't commit
the failed tree. In principle we could maybe walk the work in progress.
We also keep track of the errors and log those.
@sebmarkbage sebmarkbage requested a review from acdlite December 20, 2024 19:53
Copy link

vercel bot commented Dec 20, 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 Dec 20, 2024 8:23pm

@react-sizebot
Copy link

react-sizebot commented Dec 20, 2024

Comparing: 03297e0...3c2265a

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 +0.03% 511.38 kB 511.56 kB +0.01% 91.38 kB 91.39 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 +0.03% 516.17 kB 516.35 kB = 92.23 kB 92.23 kB
facebook-www/ReactDOM-prod.classic.js +0.03% 593.09 kB 593.26 kB = 104.45 kB 104.46 kB
facebook-www/ReactDOM-prod.modern.js +0.03% 583.35 kB 583.53 kB = 102.90 kB 102.91 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +0.91% 440.14 kB 444.16 kB +0.71% 70.93 kB 71.43 kB
oss-experimental/react-art/cjs/react-art.development.js +0.85% 587.88 kB 592.87 kB +0.48% 94.37 kB 94.82 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.75% 670.72 kB 675.73 kB +0.43% 106.77 kB 107.23 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +0.66% 567.49 kB 571.24 kB +0.43% 100.50 kB 100.93 kB
oss-experimental/react-dom/cjs/react-dom-client.development.js +0.51% 974.16 kB 979.16 kB +0.27% 164.25 kB 164.69 kB
oss-experimental/react-dom/cjs/react-dom-profiling.development.js +0.51% 990.60 kB 995.61 kB +0.26% 167.07 kB 167.50 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.51% 991.10 kB 996.10 kB +0.25% 168.00 kB 168.42 kB

Generated by 🚫 dangerJS against 9334142

sebmarkbage added a commit that referenced this pull request Dec 28, 2024
This is similar to #31876 but for Server Components.

It marks them as errored and puts the error message in the Summary
properties.

<img width="1511" alt="Screenshot 2024-12-20 at 5 05 35 PM"
src="https://github.com/user-attachments/assets/92f11e42-0e23-41c7-bfd4-09effb25e024"
/>

This only looks at the current chunk for rejections. That means that
there might still be promises deeper that rejected but it's only the
immediate return value of the Server Component that's considered a
rejection of the component itself.
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