MCPcopy
hub / github.com/TanStack/router / setupWithPathParams

Function setupWithPathParams

packages/router-core/tests/callbacks.test.ts:164–184  ·  view source on GitHub ↗
({
      loader,
      staleTime,
    }: {
      loader?: () => unknown
      staleTime?: number
    })

Source from the content-addressed store, hash-verified

162 // match-level caching, which still relies on match.id (routeId + params + loaderDeps).
163 describe('same-route match caching', () => {
164 const setupWithPathParams = ({
165 loader,
166 staleTime,
167 }: {
168 loader?: () => unknown
169 staleTime?: number
170 }) => {
171 const rootRoute = new BaseRootRoute({})
172 const postRoute = new BaseRoute({
173 getParentRoute: () => rootRoute,
174 path: '/posts/$postId',
175 loader,
176 staleTime,
177 gcTime: staleTime,
178 })
179 const routeTree = rootRoute.addChildren([postRoute])
180 return new RouterCore({
181 routeTree,
182 history: createMemoryHistory(),
183 })
184 }
185
186 test('keeps previous loaderDeps variant cached and reuses it within staleTime', async () => {
187 const loader = vi.fn()

Callers 1

callbacks.test.tsFile · 0.85

Calls 1

createMemoryHistoryFunction · 0.90

Tested by

no test coverage detected