Skip to content

Commit 9d6c63b

Browse files
brenelzbirkskyumautofix-ci[bot]
authored
test(solid-start): fix solid-query when used in ssr (#5665)
* fix: ssr query for solid * Update query-core * fix solid ssr true * reset lockfile * set experimental_prefetchInRender: true * ci: apply automated fixes * reset lock --------- Co-authored-by: Birk Skyum <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent e2be32a commit 9d6c63b

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

e2e/solid-start/basic-solid-query/src/router.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export function getRouter() {
99
const queryClient = new QueryClient({
1010
defaultOptions: {
1111
queries: {
12-
// Enable only on client to avoid hydration mismatches
13-
experimental_prefetchInRender: typeof window !== 'undefined',
12+
experimental_prefetchInRender: true,
1413
},
1514
},
1615
})

e2e/solid-start/query-integration/src/router.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query
44
import { routeTree } from './routeTree.gen'
55

66
export function getRouter() {
7-
const queryClient = new QueryClient()
7+
const queryClient = new QueryClient({
8+
defaultOptions: {
9+
queries: {
10+
experimental_prefetchInRender: true,
11+
},
12+
},
13+
})
814
const router = createRouter({
915
routeTree,
1016
context: { queryClient },

e2e/solid-start/query-integration/src/routes/useQuery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const qOptions = makeQueryOptions('useQuery')
77
export const Route = createFileRoute('/useQuery')({
88
loader: ({ context }) => context.queryClient.ensureQueryData(qOptions),
99
component: RouteComponent,
10-
ssr: 'data-only',
10+
ssr: true,
1111
})
1212

1313
function RouteComponent() {

e2e/solid-start/server-functions/src/router.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
66
import { NotFound } from './components/NotFound'
77

88
export function getRouter() {
9-
const queryClient = new QueryClient()
9+
const queryClient = new QueryClient({
10+
defaultOptions: {
11+
queries: {
12+
experimental_prefetchInRender: true,
13+
},
14+
},
15+
})
1016
const router = createRouter({
1117
routeTree,
1218
defaultPreload: 'intent',

e2e/solid-start/server-functions/src/routes/primitives/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { For, Show } from 'solid-js'
55
import { z } from 'zod'
66
export const Route = createFileRoute('/primitives/')({
77
component: RouteComponent,
8-
ssr: 'data-only',
8+
ssr: true,
99
})
1010

1111
function stringify(data: any) {

0 commit comments

Comments
 (0)