mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 23:49:03 +00:00
TanStack Start 1.169 is the stable release. This moves the shared catalog to Start 1.169.2 and Router 1.170.44, the newest matching pair that clears the 72-hour release-age gate, and updates Studio React Query and its devtools to 5.104.3. The ui-library TanStack auth blocks switch to `.validator()` because Start 1.169 removes `.inputValidator()`. **Changed:** - `pnpm-workspace.yaml` – `@tanstack/react-router` `^1.170.44` and `@tanstack/react-start` `^1.169.2`, so Router, Start, router-core, and the Start plugin install as one set - `pnpm-lock.yaml` – react-router 1.170.44, react-start 1.169.2, router-core 1.171.37, router-plugin 1.168.46, start-plugin-core 1.171.53, history 1.162.5, and Studio React Query 5.104.3 - `apps/studio/package.json` – `@tanstack/react-query` and `@tanstack/react-query-devtools` `~5.104.3`, `@tanstack/react-router-devtools` `^1.167.2` - `apps/ui-library/registry/default/blocks/password-based-auth-tanstack/routes/auth/confirm.ts` – `createServerFn` uses `.validator()` - `apps/ui-library/registry/default/blocks/social-auth-tanstack/routes/auth/oauth.ts` – `createServerFn` uses `.validator()` - `apps/ui-library/tests/sign-up-redirect.test.tsx` – the server-function mock follows the `validator` chain - `apps/ui-library/public/r/password-based-auth-tanstack.json` – registry JSON regenerated from the block - `apps/ui-library/public/r/social-auth-tanstack.json` – registry JSON regenerated from the block - `apps/ui-library/content/docs/tanstack/password-based-auth.mdx` – note that the block requires `@tanstack/react-start` 1.168.25 or later, since `.validator()` is missing from earlier Start versions - `apps/ui-library/content/docs/tanstack/social-auth.mdx` – note that the block requires `@tanstack/react-start` 1.168.25 or later, since `.validator()` is missing from earlier Start versions - `apps/studio/server.ts` – correct the header comment: `wrapFetchWithSentry` only adds a span, trace meta tags, and a flush, and request errors are captured by the Sentry middleware in `start.ts` **Removed:** - `minimumReleaseAgeExclude` pins for: - `@tanstack/react-router@1.170.41` - `@tanstack/react-start-client@1.168.39` - `@tanstack/react-start-rsc@0.1.59` - `@tanstack/react-start-server@1.167.46` - `@tanstack/react-start@1.168.60` - `@tanstack/react-store@0.11.2` - `@tanstack/router-core@1.171.34` - `@tanstack/router-generator@1.167.40` - `@tanstack/router-plugin@1.168.42` - `@tanstack/start-client-core@1.170.34` - `@tanstack/start-plugin-core@1.171.49` - `@tanstack/start-server-core@1.169.39` - `@tanstack/start-storage-context@1.167.36` - `@tanstack/store@0.11.2` ## To test - TanStack Studio, open a project home – the shell loads with no router error - TanStack Studio, open a table, switch schema, then Back and Forward – the table id follows history, and Forward returns to the later table - TanStack Studio, run a query in the SQL Editor – results render - TanStack Studio, open Project Settings – the general settings page renders - Next Studio, repeat home, Table Editor, SQL Editor, and Settings – the same pages render - ui-library TanStack password and social auth blocks, follow a sign-up confirm and OAuth confirm link – the server function accepts the search params through `.validator()` and redirects --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
105 lines
3.7 KiB
TypeScript
105 lines
3.7 KiB
TypeScript
import { QueryClient, useSuspenseQuery } from '@tanstack/react-query'
|
|
import {
|
|
createMemoryHistory,
|
|
createRootRouteWithContext,
|
|
createRoute,
|
|
createRouter,
|
|
Outlet,
|
|
RouterProvider,
|
|
} from '@tanstack/react-router'
|
|
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
|
|
import { attachRouterServerSsrUtils } from '@tanstack/react-router/ssr/server'
|
|
import { renderToString } from 'react-dom/server'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const queryOptions = {
|
|
queryKey: ['router-ssr-regression'],
|
|
queryFn: async () => 'server query result',
|
|
staleTime: Infinity,
|
|
}
|
|
|
|
function QueryPage() {
|
|
const { data } = useSuspenseQuery(queryOptions)
|
|
return <div>{data}</div>
|
|
}
|
|
|
|
function createFixture(isServer: boolean) {
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: { queries: { retry: false, gcTime: Infinity } },
|
|
})
|
|
const rootRoute = createRootRouteWithContext<{ queryClient: QueryClient }>()({
|
|
component: Outlet,
|
|
})
|
|
const page = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/',
|
|
loader: ({ context }) => context.queryClient.ensureQueryData(queryOptions),
|
|
component: QueryPage,
|
|
})
|
|
const router = createRouter({
|
|
routeTree: rootRoute.addChildren([page]),
|
|
history: createMemoryHistory({ initialEntries: ['/'] }),
|
|
context: { queryClient },
|
|
isServer,
|
|
})
|
|
setupRouterSsrQueryIntegration({
|
|
router,
|
|
queryClient,
|
|
})
|
|
if (isServer) attachRouterServerSsrUtils({ router, manifest: undefined })
|
|
return { router, queryClient }
|
|
}
|
|
|
|
describe('router SSR query integration', () => {
|
|
it('loads and renders cached queries through SSR dehydration, then releases request state', async () => {
|
|
const server = createFixture(true)
|
|
try {
|
|
await server.router.load()
|
|
expect(server.router.state.matches.every((match) => match.status === 'success')).toBe(true)
|
|
const dehydrate = server.router.options.dehydrate!
|
|
let dehydrated: Awaited<ReturnType<typeof dehydrate>> | undefined
|
|
server.router.options.dehydrate = async () => {
|
|
dehydrated = await dehydrate()
|
|
return dehydrated
|
|
}
|
|
await server.router.serverSsr?.dehydrate()
|
|
if (!dehydrated) throw new Error('Router did not dehydrate the query cache')
|
|
expect(dehydrated).toMatchObject({
|
|
query: { initial: [{ state: { data: 'server query result', status: 'success' } }] },
|
|
})
|
|
expect(renderToString(<RouterProvider router={server.router} />)).toContain(
|
|
'server query result'
|
|
)
|
|
} finally {
|
|
server.router.serverSsr?.cleanup()
|
|
}
|
|
expect(server.queryClient.getQueryCache().getAll()).toEqual([])
|
|
})
|
|
|
|
it('hydrates initial and streamed queries, then releases their request cache', async () => {
|
|
const server = createFixture(true)
|
|
const client = createFixture(false)
|
|
const pending = Promise.withResolvers<string>()
|
|
try {
|
|
await server.router.load()
|
|
const dehydrated = await server.router.options.dehydrate?.()
|
|
if (!dehydrated) throw new Error('Router did not dehydrate the query cache')
|
|
await client.router.options.hydrate?.(dehydrated)
|
|
expect(client.queryClient.getQueryData(queryOptions.queryKey)).toBe('server query result')
|
|
const request = server.queryClient.fetchQuery({
|
|
queryKey: ['late-query'],
|
|
queryFn: () => pending.promise,
|
|
})
|
|
pending.resolve('streamed query result')
|
|
await request
|
|
await expect
|
|
.poll(() => client.queryClient.getQueryData(['late-query']))
|
|
.toBe('streamed query result')
|
|
} finally {
|
|
server.router.serverSsr?.cleanup()
|
|
client.queryClient.clear()
|
|
}
|
|
expect(server.queryClient.getQueryCache().getAll()).toEqual([])
|
|
})
|
|
})
|