Skip to content
Source
Sign inSign up
TanStack/router

fix(solid-router): implement navigation transitions #5691

Mergedbirkskyum(GitHub profile, opens in a new tab)merged 24 commits intomain fromrefs/pull/5691/headmerged by birkskyum(GitHub profile, opens in a new tab)

Showing 16 changed files with 138 additions and 0 deletions (loading 10).

x
0 of 16 viewed, 16 left
53 additions and 0 deletionse2e/react-router/basic-react-query-file-based/src/routes/transition/index.tsxAdded
View file
@@ -0,0 +1,53 @@
+import { Link, createFileRoute } from '@tanstack/react-router'
+import { Suspense, useMemo } from 'react'
+import { queryOptions, useQuery } from '@tanstack/react-query'
+import { z } from 'zod'
+​
+const searchSchema = z.object({
+ n: z.number().default(1),
+})
+​
+const doubleQueryOptions = (n: number) =>
+ queryOptions({
+ queryKey: ['transition-double', n],
+ queryFn: async () => {
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+ return n * 2
+ },
+ placeholderData: (oldData) => oldData,
+ })
+​
+export const Route = createFileRoute('/transition/')({
+ validateSearch: searchSchema,
+ loader: ({ context: { queryClient }, location }) => {
+ const { n } = searchSchema.parse(location.search)
+ return queryClient.ensureQueryData(doubleQueryOptions(n))
+ },
+ component: TransitionPage,
+})