Commit 5dedf78
authored
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- src
- __test__
- integration
- app
- (auth)/auth/cli
- (rewrites)
- [[...slug]]
- not-found
- api
- sandbox
- details/polling
- inspect/root-path
- sidebar/state
- teams/user
- team/state
- dashboard
- @header
- [teamIdOrSlug]
- [...slug]
- account
- [teamIdOrSlug]
- account
- billing
- budget
- members
- sandboxes
- (tabs)
- @list
- @monitoring
- [sandboxId]
- inspect
- templates
- usage
- account
- configs
- features/dashboard
- account
- billing
- budget
- layout
- members
- sandboxes
- list
- hooks
- monitoring
- charts
- hooks
- sandbox
- header
- inspect
- settings
- general
- keys
- webhooks
- sidebar
- templates
- lib
- clients
- supabase
- hooks
- schemas
- utils
- server
- auth
- billing
- keys
- sandboxes
- team
- templates
- usage
- webhooks
- ui
- primitives
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| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments