Skip to content

feat: implement generic React Error Boundaries to prevent full app unmounts on component failure#456

Open
nitishchaubeyy wants to merge 3 commits into
indresh404:mainfrom
nitishchaubeyy:feature/error-boundaries
Open

feat: implement generic React Error Boundaries to prevent full app unmounts on component failure#456
nitishchaubeyy wants to merge 3 commits into
indresh404:mainfrom
nitishchaubeyy:feature/error-boundaries

Conversation

@nitishchaubeyy

Copy link
Copy Markdown
Contributor

Description

This PR addresses #434 by implementing route-level React Error Boundaries. Previously, an unexpected error (like malformed API data or a null Firestore snapshot) in any leaf component would crash the entire React application tree, resulting in a white screen.

Key Additions

  • ErrorBoundary.jsx Component: Created a reusable, Framer-Motion animated Class Component to catch child render errors safely. It provides a polished "Something went wrong" card UI.
  • State Recovery Mechanism: The boundary includes a "Try Again" button that triggers this.setState({ hasError: false }) to remount the child tree without forcing a hard browser refresh.
  • Route Integration: Created a withErrorBoundary higher-order helper to wrap all dynamically imported lazy routes in AppRoutes.jsx with context-specific fallback messages (e.g., "GitRank couldn't load right now...").
  • Dev DX: Added a conditional block that explicitly renders the raw .toString() error output in NODE_ENV === 'development' to aid debugging.

Fixes #434

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 11, 2026 9:00am

@github-actions github-actions Bot added backend Backend/Firebase related changes bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend/Firebase related changes bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# [Feature][Level 3]: React Error Boundaries with Graceful Fallback UI for Critical Page Components

1 participant