Skip to content

How to selectively refetch data in a loader based on query params or path changes? #12538

Closed Answered by sergiodxa
ArthurGuez asked this question in Q&A
Discussion options

You must be logged in to vote

There's no way to only fetch part of a loader, there are a few solutions.

  1. Cache the data in the loader, this way your whole loader will run again but the cached data will not be fetched/queried again.
  2. Split the route in multiple routes so each one can have a separate loader

I think 1 is better, you can use something like TanStack Query's QueryClient for that.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ArthurGuez
Comment options

Answer selected by ArthurGuez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants