Repository navigation
feat(studio): TanStack project routes — data surfaces (stack 5.1/6, from #46424) - #47117
Conversation
…RAMEWORK flag (1/6, from #46424) Foundation of the TanStack Start migration (#46424), split into a reviewable stack. Next remains the default and only active framework after this PR — the TanStack build pipeline is wired up but has no routes yet, so it isn't functional or tested until later PRs flip the feature flag. - package.json: dev/build/start now dispatch via scripts/dispatch.js (defaults to next); add :next/:tanstack variants, vite/tanstack deps. - scripts: dispatch.js, serve.js, smoke-server.mjs, generateLocalEnv.js. - vite.config.ts, turbo.jsonc, tsconfig.json (jsx: react-jsx, Bundler). - next.config.ts + redirects.shared.ts (shared redirect rules with vercel.ts), proxy.ts/start.ts middleware + hosted-api-allowlist.ts. - companion adaptations the tsconfig change requires to keep typecheck green (BufferSource casts, packages/ui unused-React import removals, etc.). Verified: frozen install, studio typecheck, Next build, and lint ratchet all green; Next stays the default build.
…46424) Adds compat/next/* — drop-in shims for next/link, next/router, next/navigation, next/head, next/image, next/script, next/dynamic, next/server, and a toWebHandler (compat/next/api.ts) that lets pages-router API handlers run as TanStack server routes. Under TanStack these are wired in via Vite aliases (next/* -> @/compat/next/*); Next never imports them, so this is purely additive. No routes consume them yet — that starts in the next stack PR. Stacked on #47107. Verified: studio typecheck + lint (0 errors).
…outes (stack 3/6, from #46424) Adds the TanStack Start app skeleton: routes/__root.tsx (root layout + redirect beforeLoad), router.tsx, and the _auth (sign-in/up, forgot/reset password, SSO/MFA/partner, CLI login) and _app (account, org/$slug, support) route trees. These are thin wrappers that render the existing pages-router page components via the compat shims from #47110. routeTree.gen.ts is REGENERATED by the tanstackStart vite plugin for exactly the routes present in this PR (not copied from the migration branch, whose tree references all ~300 routes) — so it typechecks standalone. API routes and project routes (and a full regenerated tree) land in the next stack PRs. Stacked on #47110. Verified: studio typecheck + lint (0 errors). Next is unaffected (it builds pages/, ignores routes/).
…outes (stack 4/6, from #46424) Adds routes/api/** — ~104 thin TanStack server routes, each wrapping the existing pages/api handler via toWebHandler (compat shim from S2). Mechanical and homogeneous: createFileRoute(...).server.handlers = { METHOD: handler }. Covers platform (pg-meta, auth, storage, integrations, telemetry, ...), ai, v1, connect, content/mcp, and the standalone utility endpoints. routeTree.gen.ts is REGENERATED for the routes now present (root + auth/app + api). Project page routes + the full tree land in stack 5. Stacked on #47112. Verified: studio typecheck + lint (0 errors). Next is unaffected (builds pages/, ignores routes/).
…tack 5.1/6, from #46424) First half of the project routes (split from the original S5 to stay under CodeRabbit's 150-file review limit). Covers the data cluster — database, editor, sql, storage, realtime, branches — plus the top-level/onboarding routes (authorize, join, logout, redeem, verify-email, claim-project, vercel/ github integration entrypoints) and the _app/_auth layout shells + /org/_, /project/_ catch-alls. Supporting page edits: hoist BranchesPageWrapper out of getLayout, ConnectStepsSection import.meta.glob, api/server.js. routeTree.gen.ts regenerated for the routes present so far. Remaining product surfaces (auth, logs, settings, observability, functions, advisors, integrations) land in 5.2. Stacked on #47113. Verified: studio typecheck, lint (0 errors), Next build (181/181 pages).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › queue-table-operations.spec.ts › Queue Table Operations › reverted cell edit clears the pending change Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/studio/routes/project/`$ref/database.tsx:
- Around line 17-23: The `select` callback in the `useMatches` hook currently
only reads the leaf match's `staticData` for `databaseLayoutTitle`, which
returns an empty string for nested routes that don't define their own title. Fix
this by iterating through the matches array from the end backwards (starting
from the leaf) to find the first match with a defined `databaseLayoutTitle`
property, returning that value instead of only checking the final match. This
allows nested routes like database/triggers/data.tsx to inherit the title from
the nearest parent route that defines it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: a7e2a2be-e996-4020-9131-da1e05e0fbe4
📒 Files selected for processing (80)
apps/studio/api/server.jsapps/studio/components/interfaces/ConnectSheet/ConnectStepsSection.tsxapps/studio/pages/org/_/[[...routeSlug]].tsxapps/studio/pages/project/[ref]/branches/index.tsxapps/studio/pages/project/[ref]/branches/merge-requests.tsxapps/studio/pages/project/_/[[...routeSlug]].tsxapps/studio/routeTree.gen.tsapps/studio/routes/_app.tsxapps/studio/routes/_auth.tsxapps/studio/routes/authorize.tsxapps/studio/routes/aws-marketplace-onboarding.tsxapps/studio/routes/claim-project.tsxapps/studio/routes/index.tsxapps/studio/routes/integrations/github/authorize.tsxapps/studio/routes/integrations/vercel.tsxapps/studio/routes/integrations/vercel/$slug/deploy-button/new-project.tsxapps/studio/routes/integrations/vercel/$slug/marketplace/choose-project.tsxapps/studio/routes/integrations/vercel/install.tsxapps/studio/routes/join.tsxapps/studio/routes/logout.tsxapps/studio/routes/maintenance.tsxapps/studio/routes/new/$slug.tsxapps/studio/routes/org.[_].$.tsxapps/studio/routes/org.[_].tsxapps/studio/routes/project.[_].$.tsxapps/studio/routes/project.[_].tsxapps/studio/routes/project/$ref.tsxapps/studio/routes/project/$ref/branches.tsxapps/studio/routes/project/$ref/branches/index.tsxapps/studio/routes/project/$ref/branches/merge-requests.tsxapps/studio/routes/project/$ref/database.tsxapps/studio/routes/project/$ref/database/backups/pitr.tsxapps/studio/routes/project/$ref/database/backups/restore-to-new-project.tsxapps/studio/routes/project/$ref/database/backups/scheduled.tsxapps/studio/routes/project/$ref/database/column-privileges.tsxapps/studio/routes/project/$ref/database/extensions.tsxapps/studio/routes/project/$ref/database/functions.tsxapps/studio/routes/project/$ref/database/indexes.tsxapps/studio/routes/project/$ref/database/migrations.tsxapps/studio/routes/project/$ref/database/publications/$id.tsxapps/studio/routes/project/$ref/database/publications/index.tsxapps/studio/routes/project/$ref/database/replication/$pipelineId.tsxapps/studio/routes/project/$ref/database/replication/index.tsxapps/studio/routes/project/$ref/database/replication/replica/$replicaId.tsxapps/studio/routes/project/$ref/database/roles.tsxapps/studio/routes/project/$ref/database/schemas.tsxapps/studio/routes/project/$ref/database/settings.tsxapps/studio/routes/project/$ref/database/tables/$id.tsxapps/studio/routes/project/$ref/database/tables/index.tsxapps/studio/routes/project/$ref/database/triggers.tsxapps/studio/routes/project/$ref/database/triggers/data.tsxapps/studio/routes/project/$ref/database/triggers/event.tsxapps/studio/routes/project/$ref/database/triggers/index.tsxapps/studio/routes/project/$ref/database/types.tsxapps/studio/routes/project/$ref/editor.tsxapps/studio/routes/project/$ref/editor/$id.tsxapps/studio/routes/project/$ref/editor/index.tsxapps/studio/routes/project/$ref/editor/new.tsxapps/studio/routes/project/$ref/merge.tsxapps/studio/routes/project/$ref/realtime.tsxapps/studio/routes/project/$ref/realtime/inspector.tsxapps/studio/routes/project/$ref/realtime/policies.tsxapps/studio/routes/project/$ref/realtime/settings.tsxapps/studio/routes/project/$ref/sql.tsxapps/studio/routes/project/$ref/sql/$id.tsxapps/studio/routes/project/$ref/sql/examples.tsxapps/studio/routes/project/$ref/sql/index.tsxapps/studio/routes/project/$ref/sql/templates.tsxapps/studio/routes/project/$ref/storage.tsxapps/studio/routes/project/$ref/storage/analytics/buckets/$bucketId.tsxapps/studio/routes/project/$ref/storage/analytics/index.tsxapps/studio/routes/project/$ref/storage/files/buckets/$bucketId.tsxapps/studio/routes/project/$ref/storage/files/index.tsxapps/studio/routes/project/$ref/storage/files/policies.tsxapps/studio/routes/project/$ref/storage/files/settings.tsxapps/studio/routes/project/$ref/storage/s3.tsxapps/studio/routes/project/$ref/storage/vectors/buckets/$bucketId.tsxapps/studio/routes/project/$ref/storage/vectors/index.tsxapps/studio/routes/redeem.tsxapps/studio/routes/verify-email.tsx
Iterating response.headers and calling res.setHeader collapses duplicate keys; for set-cookie the Headers iterator joins every cookie into one comma-separated value, corrupting auth/session cookies. Pull cookies out via getSetCookie() and set them as an array. Addresses PR review feedback.
The navigate() shim overloaded Next's `shallow` option as the
push-vs-replace signal, but the ternary was inverted so replace() did a
push. Inverting it naively would also break the 5 push(url, { shallow:
true }) call sites, since shallow is a real Next option (no-op here) and
has nothing to do with push vs replace. Use a dedicated internal
`_replace` flag instead, matching Next's pages-router where push always
pushes and replace always replaces regardless of shallow.
Addresses PR review feedback.
The Next pages pass inboundFlow to SignInLayout (sign-in -> 'sign-in', sign-up -> 'sign-up'), which gates the focused-provider interstitial and destination-branded heading for inbound auth links. The TanStack route wrappers dropped it. sign-in-sso intentionally left unchanged — its Next page doesn't pass inboundFlow either. Addresses PR review feedback.
…backpressure - mcp: stringify the non-Error throw in the 500 fallback instead of embedding the raw value, so a circular/non-serializable cause can't make JSON.stringify throw inside the catch. - functions body: build the multipart stream from an async generator via Readable.from(...).toWeb() so file reads honour consumer backpressure and close the file handle on client disconnect, instead of eagerly buffering every file in ReadableStream.start(). Addresses PR review feedback.
The DatabaseLayout title read only the leaf match's staticData, so trigger sub-routes (triggers/data, triggers/event, the index) that don't define their own title rendered an empty title instead of inheriting 'Triggers' from the triggers.tsx section layout. Walk up the match chain to the nearest databaseLayoutTitle. Still returns a string so the select() memoization holds. Addresses PR review feedback.
Extract the .env parser into scripts/lib/env.js so dispatch.js and serve.js use one implementation instead of duplicating the regex. dispatch.js now reads .env as well as .env.local (matching serve.js / vite precedence: shell > .env.local > .env), so STUDIO_FRAMEWORK set in .env is picked up — previously only .env.local was read, which is why setting it in .env silently did nothing. Addresses PR review feedback.
readEnvFiles swallowed every readFileSync error, so an existing-but- unreadable env file (bad permissions, IO error) was silently treated as absent — dropping its values and potentially booting serve.js without secrets like POSTGRES_PASSWORD. Skip only ENOENT and rethrow the rest. Addresses PR review feedback.
Adds a unit test guarding the dynamic-param interpolation in the next/router shim (the fix for the column-rename redirect), since the shim has been fragile to changes. Exports resolveUrl for testing only.
# Conflicts: # apps/studio/routeTree.gen.ts
master changed components/ui/NoPermission to a named-only export; update the ported TanStack route to match (was a default import, breaking the vite build).
# Conflicts: # apps/studio/routeTree.gen.ts
Braintrust eval report
|
…(stack 5.2/6, from #46424) (#47118) **Stack 5.2/6** of the TanStack Start migration (#46424) — second half of the project routes (S5 was split for CodeRabbit's 150-file cap). Stacked on **#47117** (5.1). > [!NOTE] > Same shape as 5.1 — thin route wrappers over the existing pages-router components. With this PR every route is present, so `routeTree.gen.ts` is now **byte-identical to the migration branch**. ## What's in this PR - **Remaining project routes:** auth, logs, settings, observability, functions, advisors, project-level integrations. - **Supporting edits:** hoist `EdgeFunctionsIndexPageWrapper` out of `getLayout`, `functions/secrets`, and move `DefaultLayout` to the root for the logs page. - `routeTree.gen.ts` regenerated for the full set. ## Verification On top of S1–5.1: `studio` typecheck ✓, lint (0 errors) ✓, **Next build ✓ (181/181 pages)**. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Reorganized internal routing and page structure to improve navigation and maintainability across project settings, logs, functions, authentication, integrations, and observability sections. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <[email protected]> Co-authored-by: Ivan Vasilov <[email protected]>
Stack 5.1/6 of the TanStack Start migration (#46424). The original S5 (174 files) was over CodeRabbit's 150-file review cap, so it's split into 5.1 + 5.2 by product. Stacked on #47113 (S4).
Note
Thin route wrappers rendering the existing pages-router components via compat shims. Next-safe (full Next build run). The TanStack app isn't functional end-to-end until 5.2 + the matrix flip.
What's in this PR
authorize,join,logout,redeem,verify-email,claim-project, aws-marketplace, Vercel/GitHub integration entrypoints;_app/_authlayout shells;/org/_+/project/_catch-alls.BranchesPageWrapperout ofgetLayout,ConnectStepsSectionimport.meta.glob,api/server.js.routeTree.gen.tsregenerated for the routes present so far.Verification
On top of S1–S4:
studiotypecheck ✓, lint (0 errors) ✓, Next build ✓ (181/181 pages).Summary by CodeRabbit