({
loader,
staleTime,
}: {
loader?: () => unknown
staleTime?: number
})
| 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() |
no test coverage detected