@helloleo/plugins 0.2.27 → 0.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@radix-ui/react-toggle-group": "^1.1.14",
|
|
45
45
|
"@radix-ui/react-tooltip": "^1.2.11",
|
|
46
46
|
"@tailwindcss/vite": "^4.3.2",
|
|
47
|
-
"@tanstack/react-query": "^5.
|
|
47
|
+
"@tanstack/react-query": "^5.102.8",
|
|
48
48
|
"@tanstack/react-router": "^1.170.17",
|
|
49
|
-
"@tanstack/react-router-
|
|
49
|
+
"@tanstack/react-router-ssr-query": "^1.167.2",
|
|
50
50
|
"@tanstack/react-start": "^1.168.27",
|
|
51
51
|
"class-variance-authority": "^0.7.1",
|
|
52
52
|
"clsx": "^2.1.1",
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/react-query'
|
|
2
2
|
import { createRouter as createTanStackRouter } from '@tanstack/react-router'
|
|
3
|
-
import {
|
|
3
|
+
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
|
|
4
4
|
import { routeTree } from './routeTree.gen'
|
|
5
5
|
import { DefaultErrorComponent } from '@/components/error-component'
|
|
6
6
|
|
|
7
|
-
// TanStack Start calls getRouter() on both server and client.
|
|
8
|
-
// wires the QueryClient into the router context
|
|
9
|
-
// rehydration, so loaders can call
|
|
10
|
-
// client picks the cache up
|
|
7
|
+
// TanStack Start calls getRouter() on both server and client.
|
|
8
|
+
// setupRouterSsrQueryIntegration wires the QueryClient into the router context
|
|
9
|
+
// and handles SSR dehydration / rehydration, so loaders can call
|
|
10
|
+
// context.queryClient.ensureQueryData() and the client picks the cache up
|
|
11
|
+
// without refetching.
|
|
11
12
|
export function getRouter() {
|
|
12
13
|
const queryClient = new QueryClient()
|
|
13
14
|
|
|
14
|
-
const router =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
15
|
+
const router = createTanStackRouter({
|
|
16
|
+
routeTree,
|
|
17
|
+
context: { queryClient },
|
|
18
|
+
scrollRestoration: true,
|
|
19
|
+
// Catches uncaught render/loader errors on any route. Routes can still
|
|
20
|
+
// set their own `errorComponent` to override this.
|
|
21
|
+
defaultErrorComponent: DefaultErrorComponent,
|
|
22
|
+
defaultPreload: 'intent',
|
|
23
|
+
// With React Query we never want loader data to be stale -- the loader runs
|
|
24
|
+
// on every preload/visit and React Query owns caching from there.
|
|
25
|
+
defaultPreloadStaleTime: 0,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
setupRouterSsrQueryIntegration({ router, queryClient })
|
|
29
29
|
|
|
30
30
|
return router
|
|
31
31
|
}
|