Skip to content

Commit 5dedf78

Browse files
Refactor: Dashboard core routing / data strategy to optimize performance (#168)
<!-- CURSOR_SUMMARY --> > [!NOTE] > Migrates the dashboard to a team-scoped architecture with centralized auth + team resolution, cache-tagged server actions, simplified proxy middleware, and revamped sidebar/team switching; updates all pages/APIs to use `teamIdOrSlug`. > > - **Core Routing & Auth**: > - Replace legacy middleware with a simplified `proxy` and new helpers in `server/proxy` (auth redirects), plus integration tests. > - Introduce `withTeamIdResolution` middleware to resolve/authorize `teamIdOrSlug` across server actions. > - New per-team layout `app/dashboard/[teamIdOrSlug]/layout.tsx` with `DashboardContextProvider`. > - **Caching & Config**: > - Add `CACHE_TAGS`, pervasive `use cache`/`cacheTag`/`cacheLife`, and `updateTag`-based revalidation. > - Split cookie config into `configs/cookies`, add `setTeamCookies`/`getTeamCookies` utils. > - Add `TeamIdOrSlugSchema` and helpers for team ID lookup. > - **Pages & APIs**: > - Convert billing, usage, templates, sandboxes, members, keys, webhooks to accept `teamIdOrSlug`; add API for user teams and cookie setters. > - Sandboxes restructured into parallel routes (monitoring/list), add live counter injection and revalidation action. > - Replace old dashboard layout/server context; remove injectable header routes and excess Suspense. > - **Sidebar & UX**: > - New sidebar header toggle, command palette, team switcher (SWR + API), hover-prefetch links, and blocked-team banner. > - **Sitemap & Config**: > - Export `constructSitemap` and use in rewrites; adjust `next.config` experimental flags; pipe `start` logs to `pino-pretty`. > - **Tests**: > - Add `proxy` integration tests; remove legacy middleware tests. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a5af039. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 90e871f commit 5dedf78

File tree

164 files changed

+2553
-2293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+2553
-2293
lines changed

next.config.mjs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ const config = {
66
reactStrictMode: true,
77
reactCompiler: true,
88
experimental: {
9-
staleTimes: {
10-
dynamic: 180,
11-
static: 180,
12-
},
9+
useCache: true,
10+
turbopackFileSystemCacheForDev: true,
11+
clientSegmentCache: true,
1312
serverActions: {
1413
bodySizeLimit: '5mb',
1514
},
16-
clientSegmentCache: true,
15+
authInterrupts: true,
1716
},
1817
logging: {
1918
fetches: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"<<<<<<< Next.js": "",
77
"dev": "bun scripts:check-app-env && next dev --turbopack | pino-pretty --colorize",
88
"build": "next build --turbopack",
9-
"start": "next start",
9+
"start": "next start | pino-pretty --colorize",
1010
"preview": "next build --turbopack && next start | pino-pretty --colorize",
1111
"lint": "next lint",
1212
"lint:fix": "next lint --fix",

0 commit comments

Comments
 (0)