-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Add Error Boundary to useTransition API docs #6354
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
Add Error Boundary to useTransition API docs #6354
Conversation
Size changes📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 One Page Changed SizeThe following page changed size from the code in this PR compared to its base branch:
DetailsOnly the gzipped size is provided here based on an expert tip. First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If Any third party scripts you have added directly to your app using the Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this. |
I'm looking at this again and I'm worried this isn't realistic enough to be helpful. Do we really expect people to throw on purpose directly in a transition? Or should we be trying to explain what happens when there is an unhandled error. Assuming the latter (which had been my assumption), can we make the code call some a function with a real product action name that ends up throwing? Like |
@sophiebits yes your assumption is correct it was more of a tool to demonstrate what happens with an unhandled error. That's a good point and I can update to be a more product specific example |
Co-authored-by: Jan Kassens <jan@kassens.net>
Co-authored-by: Luna <lunaleaps@gmail.com>
Co-authored-by: Luna <lunaleaps@gmail.com>
Co-authored-by: Jan Kassens <jan@kassens.net>
Co-authored-by: Luna <lunaleaps@gmail.com>
Co-authored-by: Luna <lunaleaps@gmail.com>
Not ready for review - had some merging issues and will resolve first |
Co-authored-by: Luna <lunaleaps@gmail.com>
Error Boundary now works in React canary with useTransition API and displays the fallback. This PR adds documentation with a simple usage example.
Note that we want to prevent the error dialog from displaying in the Sandpack when we throw an error so that we can show the error boundary fallback.
Preview link
Monosnap.screencast.2023-10-17.15-23-20.mp4