Skip to content

[Enhancement] Implement per-screen error boundaries to prevent full app crash on component errors #656

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions