Skip to content

refactor(dashboard): move tabs to route segments#317

Merged
ben-fornefeld merged 11 commits intomainfrom
fix/tabbar-and-page-error-propagation
May 8, 2026
Merged

refactor(dashboard): move tabs to route segments#317
ben-fornefeld merged 11 commits intomainfrom
fix/tabbar-and-page-error-propagation

Conversation

@ben-fornefeld
Copy link
Copy Markdown
Member

@ben-fornefeld ben-fornefeld commented May 8, 2026

Motivation

Dashboard tab pages were still vulnerable to stale RSC/module payloads when users navigated quickly between templates and sandboxes tabs. This PR moves route-backed tabs onto real path segments so the App Router owns tab content, loading, and error boundaries per page instead of switching tab content client-side.

Summary

  • Move templates and sandboxes tabs from ?tab= query state to /list, /builds, and /monitoring route segments.
  • Replace content-managing dashboard tabs with a nav-only tab list using hover-prefetch links.
  • Add per-tab error boundaries and keep error retries able to refresh server component data.
  • Update Next.js and webpack browser stubs so dashboard builds work with the sandbox inspector bundle.

Validation

  • bun run format:check
  • bunx tsc --noEmit --pretty false
  • bunx next build --webpack
  • targeted dashboard route integration test with required env vars

ben-fornefeld and others added 2 commits May 8, 2026 13:05
Render only the active dashboard query tab and use hover-intent prefetch for tab links. Add route-level reset-aware error boundaries so tab and page failures stay scoped to their own segment.

Co-authored-by: Cursor <cursoragent@cursor.com>
Route the dashboard-level error file through the shared reset-aware route error component so top-level dashboard failures use the same isolated recovery behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings May 8, 2026 20:06
@ben-fornefeld ben-fornefeld added the bug Something isn't working label May 8, 2026
@cla-bot cla-bot Bot added the cla-signed label May 8, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment May 8, 2026 10:58pm
web-juliett Ready Ready Preview, Comment May 8, 2026 10:58pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

PR Summary

Medium Risk
Touches core routing/build configuration (Next.js upgrade, Turbopack→Webpack defaults, tab URL structure) and adds many new error boundaries, so regressions could affect navigation and rendering across the dashboard.

Overview
package.json still contains unresolved git merge-conflict markers (<<<<<<< ...), which will break JSON parsing and installs/builds.

Upgrades Next.js to ^16.2.6 (and related sharp/@next/* deps) and switches scripts from Turbopack to Webpack; next.config.mjs adds browser aliases plus a NormalModuleReplacementPlugin to strip node: imports and route them to stubs.

Changes dashboard tabs (sandboxes/templates and sandbox details) from ?tab= client switching to real path segments, updates PROTECTED_URLS, layouts, and redirects accordingly, and adds per-route error.tsx wrappers using a new DashboardRouteError that resets on navigation and supports refresh+retry.

Reviewed by Cursor Bugbot for commit 1fd14c7. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors dashboard tab navigation to be driven by query-based routing (instead of parallel routes) and standardizes dashboard route error handling so error boundaries can reset on navigation and provide a proper “retry” action.

Changes:

  • Add onRetry support to the shared error UI, and introduce a DashboardRouteError wrapper that auto-resets on route/query changes.
  • Update DashboardTabs to render only the active tab content and switch tab links to HoverPrefetchLink.
  • Convert Templates and Sandboxes tab implementations from parallel routes (@list, @builds, @monitoring) to a single (tabs)/page.tsx that selects content based on ?tab=..., plus add route-level error.tsx files across dashboard routes.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ui/error.tsx Plumbs onRetry from the boundary wrapper down into the indicator UI.
src/ui/error-indicator.tsx Adds optional onRetry callback to drive retry behavior (otherwise falls back to router.refresh()).
src/ui/dashboard-tabs.tsx Updates active-tab resolution and only renders the active tab content; swaps tab links to HoverPrefetchLink.
src/features/dashboard/shared/route-error.tsx New shared dashboard route error component that resets on navigation/query changes and wires reset into retry.
src/app/dashboard/error.tsx Switches to DashboardRouteError and uses Next.js reset.
src/app/dashboard/[teamSlug]/webhooks/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/usage/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/templates/[templateId]/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/templates/[templateId]/builds/[buildId]/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/templates/(tabs)/page.tsx New unified templates tabs page that selects list/builds via ?tab=.
src/app/dashboard/[teamSlug]/templates/(tabs)/layout.tsx Updates templates tabs layout to use children instead of parallel-route slots.
src/app/dashboard/[teamSlug]/templates/(tabs)/error.tsx Adds error boundary for the templates tabs route group.
src/app/dashboard/[teamSlug]/templates/(tabs)/@list/page.tsx Removes parallel-route list page (replaced by unified tabs page).
src/app/dashboard/[teamSlug]/templates/(tabs)/@list/default.tsx Removes parallel-route list default.
src/app/dashboard/[teamSlug]/templates/(tabs)/@builds/page.tsx Removes parallel-route builds page (replaced by unified tabs page).
src/app/dashboard/[teamSlug]/templates/(tabs)/@builds/default.tsx Removes parallel-route builds default.
src/app/dashboard/[teamSlug]/sandboxes/[sandboxId]/monitoring/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/sandboxes/[sandboxId]/logs/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/sandboxes/[sandboxId]/filesystem/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/sandboxes/[sandboxId]/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/page.tsx Replaces placeholder with unified sandboxes tabs page selecting monitoring/list via ?tab= (and prefetching list data).
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/layout.tsx Updates sandboxes tabs layout to use children instead of parallel-route slots.
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/error.tsx Adds error boundary for the sandboxes tabs route group.
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/@monitoring/page.tsx Removes parallel-route monitoring page (replaced by unified tabs page).
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/@monitoring/default.tsx Removes parallel-route monitoring default.
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/@list/page.tsx Removes parallel-route list page (replaced by unified tabs page).
src/app/dashboard/[teamSlug]/sandboxes/(tabs)/@list/default.tsx Removes parallel-route list default.
src/app/dashboard/[teamSlug]/members/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/limits/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/keys/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/general/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/error.tsx Adds route-level error boundary at the team dashboard segment.
src/app/dashboard/[teamSlug]/billing/plan/select/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/billing/plan/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/billing/error.tsx Adds route-level error boundary using DashboardRouteError.
src/app/dashboard/[teamSlug]/account/error.tsx Adds route-level error boundary using DashboardRouteError.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/dashboard-tabs.tsx Outdated
Apply formatter output for the shared dashboard route error component so format CI passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@matthewlouisbrockman matthewlouisbrockman left a comment

Choose a reason for hiding this comment

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

some bot comments and formatting nit need to get fixed but looks god direction

Comment thread src/ui/error-indicator.tsx
Streamline dashboard tab resolution and rendering while preserving active-tab-only content rendering and hover-based prefetch behavior. Include lockfile updates from local tooling to keep installs reproducible.

Co-authored-by: Cursor <cursoragent@cursor.com>
Call router.refresh() before reset() in dashboard route error retries so server-component failures can recover instead of immediately replaying cached error state.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid direct indexed access in dashboard tabs by guarding the first tab before use so strict TypeScript builds pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
Make dashboard tabs navigation-only and move templates and sandboxes tabs onto path segments so each tab owns its page content and error boundary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Update Next.js and add browser stubs for Node built-ins pulled into the sandbox inspector client bundle so webpack builds can compile successfully.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/app/dashboard/route.ts Outdated
Move the dashboard tab redirect map into a config module so integration tests can import it without violating Next route export constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ben-fornefeld ben-fornefeld changed the title fix(dashboard): isolate tab routing and error boundaries refactor(dashboard): move tabs to route segments May 8, 2026
Copy link
Copy Markdown
Contributor

@matthewlouisbrockman matthewlouisbrockman left a comment

Choose a reason for hiding this comment

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

huh good catch!

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cabdb74. Configure here.

Comment thread next.config.mjs
ben-fornefeld and others added 2 commits May 8, 2026 15:51
Add an explicit fs/promises browser alias so node:fs/promises requests still resolve correctly after the webpack node: scheme replacement runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add integration coverage for webpack browser stub aliases and the sandbox inspector's E2B filesystem methods so build-time shims and runtime SDK usage stay aligned.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ben-fornefeld ben-fornefeld merged commit c664bbb into main May 8, 2026
15 checks passed
@ben-fornefeld ben-fornefeld deleted the fix/tabbar-and-page-error-propagation branch May 8, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla-signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants