Overview
The app has a global error boundary at the root level but no screen-level boundaries. A runtime error in MobileProfile unmounts the entire navigation tree, showing the root error boundary UI (likely a blank screen or generic 'Something went wrong') and forcing a full app reload. With per-screen boundaries, only the affected screen shows an error UI while the rest of the app remains functional.
Specifications
Features:
ScreenErrorBoundary component wrapping each major screen
- Error UI: 'This screen encountered an error' with 'Retry' and 'Go Home' buttons
- Error details sent to Sentry from
componentDidCatch
- User can recover without full app restart
Tasks:
- Create
src/components/common/ScreenErrorBoundary.tsx as class component
componentDidCatch sends error to Sentry with screen context tag
- Wrap each screen in
expo-router layout with ScreenErrorBoundary
- 'Retry' button calls
this.setState({ hasError: false }) to unmount/remount screen
- Add unit test rendering error state and confirming recovery
Impacted Files:
src/components/common/ScreenErrorBoundary.tsx (create)
src/app/ or expo-router layout files
Acceptance Criteria
- Error in MobileProfile does not crash navigation or other screens
- Error UI shows with Retry and Go Home buttons
- Sentry receives error event with screen name context tag
- Retry button successfully re-renders screen after dismissing error state
Overview
The app has a global error boundary at the root level but no screen-level boundaries. A runtime error in
MobileProfileunmounts the entire navigation tree, showing the root error boundary UI (likely a blank screen or generic 'Something went wrong') and forcing a full app reload. With per-screen boundaries, only the affected screen shows an error UI while the rest of the app remains functional.Specifications
Features:
ScreenErrorBoundarycomponent wrapping each major screencomponentDidCatchTasks:
src/components/common/ScreenErrorBoundary.tsxas class componentcomponentDidCatchsends error to Sentry withscreencontext tagexpo-routerlayout withScreenErrorBoundarythis.setState({ hasError: false })to unmount/remount screenImpacted Files:
src/components/common/ScreenErrorBoundary.tsx(create)src/app/or expo-router layout filesAcceptance Criteria