TanStackT
TanStackโ€ข9mo agoโ€ข
10 replies
efficient-indigo

Navigating while refetch is in progress results in cache not being used

I was wondering if the behavior I am observing is a bug, or if I am doing something wrong.

When defining a loader with long loading time I see the stale data as expected when navigating to the route from another route. The navigation also correctly triggers the refetch of the stale data.

Now when I navigate to another route after triggering the refetch without waiting for the refetch to be done, and navigating back to the route immediately, I don't get the stale data, but instead have to wait for the loader to be done.

Debug Tools show the stale loaderData with the 'fetching' status, so it seems like cached data should be there for display.

Is this behavior expected? If so, what's the reason behind this? I'd love to understand the internal logic and maybe even contribute if this turns out to be a bug ๐Ÿ™‚
Was this page helpful?