Files
supabase/apps/studio/routes/org.[_].tsx
Alaister YoungandAlaister Young 801e4ad285 [FE-3106] (part 12) – refactor(studio): replace the org and project catch-all pages (#53221)
Gives the `/org/_/…` and `/project/_/…` catch-alls proper TanStack
routes and deletes `pages/org/_/[[...routeSlug]].tsx` and
`pages/project/_/[[...routeSlug]].tsx` (FE-3106). They show an org or
project picker whose links forward the trailing path and the query
string (and, for projects, the hash) to the real org or project. Part 12
of the stack.

**Depends on:** #53220

**Changed:**
- `components/interfaces/Organization/SelectOrganizationPage.tsx`,
`components/interfaces/Home/ProjectList/SelectProjectPage.tsx` – the
picker bodies. The trailing path and query string come from
`useLocation()` (repeated query keys survive): the splat routes nest
under the `/org/_` and `/project/_` routes, which render the picker with
no `<Outlet>`, so the picker can't rely on its own route's `_splat`
- `routes/{org,project}.[_].tsx`, `routes/{org,project}.[_].$.tsx` –
render the pickers
- `tests/routes/org.[_].$.test.tsx` – covers path and query forwarding

**Removed:**
- both catch-all pages, and `parseCatchAllRoute` from
`compat/next/router.ts`

Addresses
[FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages).

## To test

- `/project/_/database/tables?schema=auth#x` – pick a project, lands on
`/project/<ref>/database/tables?schema=auth#x`
- `/org/_/billing?panel=x` – pick an org, lands on
`/org/<slug>/billing?panel=x`
- `/org/_` and `/project/_` – pickers link to the org or project home

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 17:04:17 +09:00

25 lines
1.0 KiB
TypeScript

import { createFileRoute } from '@tanstack/react-router'
import { SelectOrganizationPage } from '@/components/interfaces/Organization/SelectOrganizationPage'
export const Route = createFileRoute('/org/_')({
component: OrgWildcardIndexRoute,
})
// Matches `/org/_`, and is also the parent of the splat route in
// `org.[_].$.tsx` (`/org/_/...`). It renders no `<Outlet>`, so this
// component renders for both.
//
// `[_]` is TanStack's escape syntax for a literal underscore in the URL
// (otherwise an unescaped `_` segment is treated as a pathless layout).
//
// Naming delta: this is `org.[_].tsx`, not `org/[_]/index.tsx`, to side-
// step a router-generator bug — when an index.tsx's path has a bracket-
// escaped *parent* segment, `originalRoutePath` gets wiped wholesale and
// the escape info is lost (getRouteNodes.js:132 sets originalRoutePath
// to `/`). The path-as-filename form keeps the last segment non-index,
// so the bug branch is skipped.
function OrgWildcardIndexRoute() {
return <SelectOrganizationPage />
}