Getting Started
- Fork the repository: https://github.com/JointSave-org/Joint_Save
- Clone your fork:
git clone https://github.com/<your-username>/Joint_Save.git
cd Joint_Save
- Create a new branch:
git checkout -b feat/react-error-boundaries
Overview
The dashboard currently has zero React error boundaries. If any component throws during rendering (e.g., due to unexpected null data from an RPC call, a network error propagating as an undefined property access, or a JavaScript runtime error), the entire page crashes and the user sees a blank white screen or Next.js's generic error page. This is especially dangerous in a financial application where users may have unsaved state or pending transactions.
@tanstack/react-query is already imported in web3-provider.tsx but its ErrorBoundary integration is unused. The react-error-boundary package is not currently installed.
This issue adds React error boundaries with meaningful fallback UIs to all dashboard page routes, preventing total page crashes and giving users actionable recovery options.
Requirements
Error Boundary Component
- Install
react-error-boundary (or implement a class-based ErrorBoundary if avoiding new dependencies is preferred)
- Create
components/error-boundary.tsx with:
- A reusable
ErrorBoundary wrapper component
- Fallback UI that shows: a friendly error message, the error details (expandable), and a "Try Again" button that calls
resetErrorBoundary
- A "Go to Dashboard" link as a secondary recovery option
- Log the error to an external service or console for debugging (the existing Vercel Analytics integration could be extended, or use a simple POST to a new
/api/errors endpoint)
Page-Level Wrapping
Wrap each dashboard page route in the error boundary:
app/dashboard/page.tsx — the main dashboard
app/dashboard/group/[id]/page.tsx — group detail page
app/dashboard/notifications/page.tsx — notifications page
app/explore/page.tsx — explore page
app/dashboard/create/[type]/page.tsx — pool creation form
Granular Boundaries
Within the group detail page, add inner error boundaries around each major section so that a failure in one section (e.g., the yield dashboard) doesn't take down the entire page:
- Pool details/info section
- Group actions section
- Members list section
- Activity feed section
- Yield dashboard section
- Audit log section
Error Reporting
- Create a lightweight
frontend/lib/error-reporting.ts utility that:
- Captures error message, component stack, and user wallet address (if connected)
- Sends to a new API route
POST /api/errors that logs to the cron_job_logs table (reusing the existing table with job_name: 'client_error')
- Rate-limited: max 5 error reports per minute per wallet to avoid flooding
Testing
- Write a component test that verifies the error boundary catches a thrown error and renders the fallback UI
- Test that "Try Again" correctly resets the boundary and re-renders the children
- Test that the error reporting utility sends the correct payload
Acceptance Criteria
Getting Started
Overview
The dashboard currently has zero React error boundaries. If any component throws during rendering (e.g., due to unexpected null data from an RPC call, a network error propagating as an undefined property access, or a JavaScript runtime error), the entire page crashes and the user sees a blank white screen or Next.js's generic error page. This is especially dangerous in a financial application where users may have unsaved state or pending transactions.
@tanstack/react-queryis already imported inweb3-provider.tsxbut itsErrorBoundaryintegration is unused. Thereact-error-boundarypackage is not currently installed.This issue adds React error boundaries with meaningful fallback UIs to all dashboard page routes, preventing total page crashes and giving users actionable recovery options.
Requirements
Error Boundary Component
react-error-boundary(or implement a class-based ErrorBoundary if avoiding new dependencies is preferred)components/error-boundary.tsxwith:ErrorBoundarywrapper componentresetErrorBoundary/api/errorsendpoint)Page-Level Wrapping
Wrap each dashboard page route in the error boundary:
app/dashboard/page.tsx— the main dashboardapp/dashboard/group/[id]/page.tsx— group detail pageapp/dashboard/notifications/page.tsx— notifications pageapp/explore/page.tsx— explore pageapp/dashboard/create/[type]/page.tsx— pool creation formGranular Boundaries
Within the group detail page, add inner error boundaries around each major section so that a failure in one section (e.g., the yield dashboard) doesn't take down the entire page:
Error Reporting
frontend/lib/error-reporting.tsutility that:POST /api/errorsthat logs to thecron_job_logstable (reusing the existing table withjob_name: 'client_error')Testing
Acceptance Criteria