mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
The `edgeFunctionsOverview` flag is fully rolled out, so the edge function Overview page now always renders the new Overview. This removes the legacy Overview and everything only it used. - **Overview page**: renders `EdgeFunctionOverview` directly, like the other function tabs. The flag check and the loader shown while flags load are gone. - **`EdgeFunctionRecentInvocations`** and its utils: only the legacy Overview showed this list. - **`components/ui/Charts/AreaChart`**: the legacy Overview was its last importer. The other `AreaChart` uses are recharts' own. **Self-hosted:** flags never load off-platform, so self-hosted Studio always got the legacy Overview. Its Overview tab is already hidden, and the new Overview sends a direct visit to the Details tab, so nothing reachable from the UI changes. After this ships, the `edgeFunctionsOverview` flag can be deleted in ConfigCat. ### How to test 1. Open an edge function's Overview on platform. It shows the new Overview, with no loader flash while flags load. 2. Self-hosted: open `/project/default/functions/<slug>` directly. It redirects to the Details tab. ### Validation - Studio typecheck, lint, Prettier and knip pass on this layer. Functions and Charts unit tests pass. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com>
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
import { dehydrate, QueryClient } from '@tanstack/react-query'
|
|
import { waitFor } from '@testing-library/react'
|
|
import { FeatureFlagContext } from 'common'
|
|
import { HttpResponse } from 'msw'
|
|
import { createDynamicRouteParser } from 'next-router-mock/dynamic-routes'
|
|
import { useRouter } from 'next/router'
|
|
import { afterAll, expect, it, vi } from 'vitest'
|
|
|
|
import type { EdgeFunction } from '@/data/edge-functions/edge-function-query'
|
|
import { projectKeys } from '@/data/projects/keys'
|
|
import OverviewPage from '@/pages/project/[ref]/functions/[functionSlug]/index'
|
|
import { createMockProject } from '@/tests/helpers'
|
|
import { customRender } from '@/tests/lib/custom-render'
|
|
import { addAPIMock } from '@/tests/lib/msw'
|
|
|
|
vi.unmock('common')
|
|
|
|
const { default: routerMock } =
|
|
await vi.importMock<typeof import('next-router-mock')>('next/router')
|
|
const removeRouteParser = routerMock.useParser(
|
|
createDynamicRouteParser([
|
|
'/project/[ref]/functions/[functionSlug]',
|
|
'/project/[ref]/functions/[functionSlug]/details',
|
|
])
|
|
)
|
|
afterAll(removeRouteParser)
|
|
|
|
it('redirects the self-hosted overview to function details before feature flags load', async () => {
|
|
routerMock.setCurrentUrl('/project/default/functions/send-email')
|
|
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } })
|
|
queryClient.setQueryData(projectKeys.detail('default'), createMockProject({ ref: 'default' }))
|
|
addAPIMock({
|
|
method: 'get',
|
|
path: '/v1/projects/:ref/functions/:function_slug',
|
|
response: () =>
|
|
HttpResponse.json<EdgeFunction>({
|
|
id: 'function-id',
|
|
name: 'Send email',
|
|
slug: 'send-email',
|
|
status: 'ACTIVE',
|
|
version: 2,
|
|
created_at: new Date('2026-03-20T08:00:00Z').valueOf(),
|
|
updated_at: new Date('2026-03-20T09:00:00Z').valueOf(),
|
|
}),
|
|
})
|
|
|
|
const OverviewRoute = () => {
|
|
const { asPath } = useRouter()
|
|
return asPath === '/project/default/functions/send-email' ? (
|
|
<OverviewPage dehydratedState={dehydrate(queryClient)} />
|
|
) : null
|
|
}
|
|
|
|
customRender(
|
|
<FeatureFlagContext.Provider value={{ configcat: {}, posthog: {}, hasLoaded: false }}>
|
|
<OverviewRoute />
|
|
</FeatureFlagContext.Provider>,
|
|
{ queryClient }
|
|
)
|
|
|
|
await waitFor(() =>
|
|
expect(routerMock.asPath).toBe('/project/default/functions/send-email/details')
|
|
)
|
|
})
|