Files
supabase/apps/studio/routes/project/$ref/functions.tsx
4129c8954d feat(studio): TanStack project routes — auth/logs/settings/functions (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 <10985857+alaister@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-07-06 18:31:18 +08:00

42 lines
1.4 KiB
TypeScript

import { createFileRoute, Outlet, useMatches } from '@tanstack/react-router'
import EdgeFunctionsLayout from '@/components/layouts/EdgeFunctionsLayout/EdgeFunctionsLayout'
export const Route = createFileRoute('/project/$ref/functions')({
component: FunctionsShell,
})
type FunctionsStaticData = {
functionsLayoutTitle?: string
// The $functionSlug routes wrap themselves in <EdgeFunctionDetailsLayout>,
// which already renders <EdgeFunctionsLayout> internally. Without
// opting out here we'd double-wrap.
skipFunctionsLayout?: boolean
}
function FunctionsShell() {
// `skipFunctionsLayout` is set on the $functionSlug sub-shell's
// staticData, not on the leaf — so checking only the leaf misses it
// and we end up double-wrapping (`functions.tsx` adds
// EdgeFunctionsLayout, then the sub-shell's EdgeFunctionDetailsLayout
// wraps EdgeFunctionsLayout again internally → duplicated sidebar).
// Scan the whole match chain instead.
const skip = useMatches({
select: (matches) =>
matches.some((m) => (m.staticData as FunctionsStaticData | undefined)?.skipFunctionsLayout),
})
const title = useMatches({
select: (matches) =>
(matches[matches.length - 1]?.staticData as FunctionsStaticData | undefined)
?.functionsLayoutTitle ?? '',
})
if (skip) return <Outlet />
return (
<EdgeFunctionsLayout title={title}>
<Outlet />
</EdgeFunctionsLayout>
)
}