fix: wrap every route in error boundary with working try again reset - #586
Open
waterWang wants to merge 1 commit into
Open
fix: wrap every route in error boundary with working try again reset#586waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
- Upgrade ErrorBoundary with onReset and resetKeys support, inject working 'Try Again' handler into fallback, log component stack trace - Add RouteBoundary in App.tsx that auto-resets on route change - Wrap /login and /auth-callback routes in ErrorBoundary - Wire real onReset at the root boundary in main.tsx
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps every route in the app with an
ErrorBoundarythat provides a meaningful fallback UI and a working "Try Again" button. Route changes automatically recover from error states.Changes
ErrorBoundary.tsx— New capabilitiesonResetprop: Called when the boundary resets (e.g. user clicks "Try Again")resetKeysprop: When keys change, the boundary auto-recovers — enables route-based recoveryonResethandler into the fallback element when it doesn't already have one, so the "Try Again" button inErrorFallbackactually clears the error statecomponentDidCatchnow logsconsole.error(...)with the error and component stackApp.tsx— Route boundary unificationRouteBoundarycomponent that usesuseLocation().pathnameasresetKeys— navigating away from a crashed route automatically recovers/loginand/auth-callback) inRouteBoundaryonReset={() => {}}no-op from all route fallbacksmain.tsx— Root boundary now uses real resetonReset={() => {}}no-op from the root ErrorBoundary; the component now injects the real handler automaticallyAcceptance Criteria