mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
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>
20 lines
751 B
TypeScript
20 lines
751 B
TypeScript
import { createFileRoute } from '@tanstack/react-router'
|
|
|
|
import { SelectOrganizationPage } from '@/components/interfaces/Organization/SelectOrganizationPage'
|
|
|
|
export const Route = createFileRoute('/org/_/$')({
|
|
component: OrgWildcardSplatRoute,
|
|
})
|
|
|
|
// Registers `/org/_/...`. Its parent `org.[_].tsx` renders the picker, which
|
|
// reads the trailing path from the location.
|
|
//
|
|
// Naming delta: `org.[_].$.tsx` (path-as-filename) rather than
|
|
// `org/[_]/$.tsx` (nested directory) — see `org.[_].tsx` for the full
|
|
// rationale; in short, the directory + index.tsx form trips a
|
|
// router-generator bug that strips the escaped `_` segment when the
|
|
// last segment isn't escaped.
|
|
function OrgWildcardSplatRoute() {
|
|
return <SelectOrganizationPage />
|
|
}
|