Skip to content

feat: add error boundaries for feature modules - #101

Merged
jobbykings merged 1 commit into
Epondia:mainfrom
MerlinTheWhiz:feature/error-boundaries
Jun 22, 2026
Merged

feat: add error boundaries for feature modules#101
jobbykings merged 1 commit into
Epondia:mainfrom
MerlinTheWhiz:feature/error-boundaries

Conversation

@MerlinTheWhiz

Copy link
Copy Markdown
Contributor

Description

Add error boundary wrappers to all major feature modules so a crash in any one
component no longer takes down the entire app. Every feature page and standalone
component now has its own boundary with a graceful fallback UI.

  • ErrorBoundary — full-page red-themed fallback with "Something went wrong",
    "Try Again", and "Go Home". Used for Lab and Campus pages.
  • RouteErrorBoundary — amber/warning-themed per-section fallback with
    "Could not load {section}" and "Retry Section". Used inside BCIDashboard for
    per-tab isolation.
  • Both now also export as default for import convenience.

Related Issue

Closes #71

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📚 Documentation update
  • ♻️ Refactor (no functional change)
  • 🧪 Tests
  • 🔧 Chore / tooling

Packages Affected

  • contracts/ (Soroban / Rust)
  • backend/ (Node / Express)
  • frontend/ (Next.js)
  • docs/

How Has This Been Tested?

  • Existing tests: all 59 existing ErrorBoundary + RouteErrorBoundary tests pass.
  • New tests: 13 new tests covering BCIDashboard (tab crash → RouteErrorBoundary catches,
    tab switching recovers, sidebar stays functional, dev/prod mode) and NanoLearningHub
    (normal render, empty skills, section presence).
  • Type check: tsc --noEmit clean on all modified files.
  • Lint: next lint clean — no new warnings or errors.

Run with (from frontend/): npm test -- --no-cache --runInBand src/components/__tests__/
(if memory-constrained, use the programmatic inline config as described in the issue thread).

Checklist

  • My code follows the project's coding standards
  • I have run the relevant linters and type checks
  • I have added or updated tests that prove my change works
  • All new and existing tests pass locally
  • I have updated documentation where needed
  • My commits follow the Conventional Commits format
  • I have noted any breaking changes below

Breaking Changes

None

Additional Notes / Screenshots

Files modified:

  • frontend/src/components/ErrorBoundary.tsx — added default export
  • frontend/src/components/RouteErrorBoundary.tsx — added default export
  • frontend/src/app/lab/page.tsx — wrapped <VirtualScienceLab /> in <ErrorBoundary>
  • frontend/src/app/campus/page.tsx — wrapped <MetaverseCampus /> in <ErrorBoundary>
  • frontend/src/components/BCI/BCIDashboard.tsx — wrapped each tab's renderActiveTab()
    in <RouteErrorBoundary routeName={...}> for per-tab crash isolation
  • frontend/src/components/NanoLearning/NanoLearningHub.tsx — wrapped JSX in <ErrorBoundary>

Files added:

  • frontend/src/components/__tests__/BCIDashboard.test.tsx
  • frontend/src/components/__tests__/NanoLearningHub.test.tsx

Screenshot

image

@jobbykings
jobbykings merged commit 9409c45 into Epondia:main Jun 22, 2026
5 checks passed
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.

Add error boundaries for all feature modules

2 participants