-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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 Flight fixture #26695
Add error boundary to Flight fixture #26695
Conversation
Comparing: fd3fb8e...9cfd696 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also use it for src/Button.js
?
fixtures/flight/src/Form.js
Outdated
<ErrorBoundary> | ||
<form | ||
action={async formData => { | ||
setIsPending(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this even work now given that this whole thing should be a transition now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah I guess it doesn't. I could wrap it in flushSync temporarily. Or maybe just wait to update the fixture until I add useFormPending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH that behavior is broken anyway. So I'l do the flushSync for now, with a TODO explaining it's temporary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isPending
state is dead code anyways. I think it's copy & paste from the button example where it controlled the disabled state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just there to illustrate what the pattern is. Everything resolves so fast anyway you don't notice in the button example either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, when I introduced it in https://github.com/facebook/react/pull/26293/files there was a delay of 500ms in the action. 🤷
Errors in form actions are now rethrown during render (facebook#26689), so we can handle the using an error boundary.
8aa62c4
to
9cfd696
Compare
Errors in form actions are now rethrown during render (#26689), so we can handle them using an error boundary.
Errors in form actions are now rethrown during render (facebook#26689), so we can handle them using an error boundary.
Errors in form actions are now rethrown during render (#26689), so we can handle them using an error boundary.