Skip to content

feat: add dashboard-scoped error boundary#1220

Merged
MODSetter merged 1 commit intoMODSetter:devfrom
mvanhorn:osc/1195-dashboard-error-boundary
Apr 14, 2026
Merged

feat: add dashboard-scoped error boundary#1220
MODSetter merged 1 commit intoMODSetter:devfrom
mvanhorn:osc/1195-dashboard-error-boundary

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented Apr 14, 2026

Summary

Fixes #1195 - adds a dashboard-scoped error boundary so the sidebar/navigation stay visible when a route segment under /dashboard throws.

Changes

  • Adds surfsense_web/app/dashboard/error.tsx - a "use client" error boundary that:
    • Renders inside the existing dashboard layout so sidebar and nav remain mounted
    • Calls reset() to retry the failed segment without a full tree re-render
    • Offers a secondary "Go to dashboard home" link for unrecoverable errors
    • Reports to PostHog using the same dynamic-import pattern as the root surfsense_web/app/error.tsx

Uses tabs + double quotes to match the biome config enforced in the repo.

Testing

Visual only - added an error boundary. Confirmed it renders (Next.js App Router routes error.tsx automatically). Not adding a test because the root error.tsx has none and the behavior is framework-provided.

Checklist

  • Scope is limited to the one file the issue asked for
  • Matches the existing PostHog pattern from root error.tsx
  • Uses existing Tailwind tokens (bg-primary, muted-foreground) - no new styling

High-level PR Summary

This PR adds a dashboard-scoped error boundary component that preserves the sidebar and navigation when errors occur within dashboard routes. The error boundary captures exceptions and reports them to PostHog, provides users with a retry mechanism via the reset() function, and includes a fallback link to navigate back to the dashboard home for unrecoverable errors.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/app/dashboard/error.tsx

Need help? Join our Discord

Analyze latest changes

Closes MODSetter#1195.

Adds `surfsense_web/app/dashboard/error.tsx` so unhandled errors in any
dashboard route render inside the dashboard layout (sidebar/nav stay
visible) instead of blowing out to the root-level error page. `reset()`
now retries just the failed segment.

Follows the same PostHog capture pattern as the root error.tsx and adds
a secondary "Go to dashboard home" link for recovery when `reset()`
doesn't help.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

@mvanhorn is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 7c4d1a6..1188550

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (1)

surfsense_web/app/dashboard/error.tsx

@MODSetter MODSetter merged commit 94dbbfa into MODSetter:dev Apr 14, 2026
7 of 10 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.

2 participants