Skip to content

Conversation

@kennethkabogo
Copy link
Contributor

Description

This PR implements React Error Boundaries across the client application to prevent catastrophic app crashes (white screens) and provide a graceful fallback UI when errors occur.

Key changes:

  • Root Level: Wrapped the entire app in app/_layout.tsx to catch unhandled errors and show a full-screen fallback.
  • Feature Level: Added boundaries to critical features like ChatManager and DataPreloader to isolate failures (e.g., if chat fails, the wallet might still work).
  • Components: Created reusable ErrorBoundary and ErrorFallback components using react-error-boundary.
  • UX: The fallback UI includes a "Try Again" button to allow users to recover from transient errors without reloading the entire app.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • [✔️ ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Release (version bump)

Release

Is this a release? No

Testing

  • Unit Tests: Added apps/client/tests/unit/ErrorBoundary.test.tsx to verify:
    • Error catching at different levels (root, feature, component).
    • Correct rendering of the fallback UI.
    • "Try Again" reset functionality.
    • Dev-mode error details.
  • Manual Verification: Verified that throwing errors in wrapped components triggers the fallback UI instead of crashing the app.

Checklist

  • [ ✔️] My code follows the project's style guidelines
  • [✔️ ] I have performed a self-review of my own code
  • [ ✔️] I have commented my code, particularly in hard-to-understand areas
  • [ ✔️] My changes generate no new warnings or errors
  • [ ✔️] I have added tests that prove my fix is effective or that my feature works
  • [ ✔️] New and existing tests pass locally with my changes
  • [ ✔️] If releasing, I have verified the version number is correct and follows semantic versioning

@kennethkabogo kennethkabogo marked this pull request as ready for review December 2, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant