Skip to content

ErrorBoundary is not wrapping any screen — render errors crash the entire app with no recovery #16

Description

@cybermax4200

Why this matters now

ErrorBoundary.tsx is a complete, well-implemented class component with retry logic, but it is used nowhere. App.tsx renders <RootNavigator /> with no boundary. Any uncaught render error (e.g. null dereference on a corrupted persisted MMKV state) crashes the entire app to a blank screen with no recovery path for the user.

Problem / What

App.tsx renders <RootNavigator /> directly. The ErrorBoundary component has zero consumers in the entire codebase. There is no "clear app data" escape hatch if persisted state becomes corrupted.

Key Challenges

  • Granularity: a single top-level boundary vs. per-screen boundaries — the right answer is both (top-level as safety net, per-screen for targeted recovery).
  • "Try Again" alone is insufficient for corrupted state — a "Clear data and restart" secondary action must be available but not the default.
  • componentDidCatch must log errors for debugging.

Acceptance Criteria

  • App.tsx wraps <RootNavigator> in <ErrorBoundary>.
  • HomeScreen, TaskListScreen, WalletScreen, ProfileScreen each have an individual <ErrorBoundary> with a screen-specific fallback.
  • Fallback UI includes a "Clear app data" button that wipes MMKV stores and reloads to Onboarding.
  • ErrorBoundary calls console.error(error, info) in componentDidCatch.
  • components.test.tsx gains a test: component throws → boundary renders fallback, no crash.

Relevant files

  • src/components/ErrorBoundary.tsx
  • App.tsx
  • src/screens/HomeScreen.tsx, TaskListScreen.tsx, WalletScreen.tsx, ProfileScreen.tsx

Labels

type: reliability, difficulty: intermediate, area: error-handling

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions