Skip to content

[BUG] Missing React error boundaries mean a single failed API component crashes the entire dashboard UI #2844

Description

@anshul23102

Problem

The dashboard renders multiple independent data widgets (streak, PR metrics, commit graph, language breakdown). If any one of them throws a JavaScript error during rendering (e.g., due to an unexpected API response shape), React unmounts the entire component tree and shows a blank page. Users lose visibility into all other dashboard sections because of a failure in just one widget.

Steps to Reproduce

  1. Modify the GitHub stats API to return null for the streak field
  2. Load the dashboard
  3. Observe the entire page goes blank rather than just the streak widget showing an error state

Expected Behavior

A failed widget should show an inline error placeholder while all other widgets continue to render normally.

Proposed Fix

Wrap each independent widget in an ErrorBoundary component:

class ErrorBoundary extends React.Component {
  state = { hasError: false };
  static getDerivedStateFromError() { return { hasError: true }; }
  render() {
    if (this.state.hasError) {
      return <WidgetErrorFallback message="Could not load this section." />;
    }
    return this.props.children;
  }
}

// Usage
<ErrorBoundary><StreakWidget /></ErrorBoundary>
<ErrorBoundary><PRMetricsWidget /></ErrorBoundary>

Complexity: Level 2 | Program: GSSOC '26

Metadata

Metadata

Assignees

Labels

gssoc:assignedGSSoC: Issue assigned to a contributor

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions