-
I have an app where I need to fetch a lot of items incrementally, so for simplicity, assume that I have the item ids in an array, then I call the API with This call becomes something like:
During rendering, each item is just mounted as a component with its own id, so it would be easiest if it can pull out the data fetched for its specific id, but this call becomes:
But from what I can see, the partial matching algorithm won't match the prefetched items. I guess a possible solution would be to map |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
the query keys need to strictly match when calling useQuery. You could manually prime the cache after prefetching and create one entry per id. Or, with select, you would get a useSelector like api:
but you have to tag around all ids for the query key, and every refetch will still fetch all items |
Beta Was this translation helpful? Give feedback.
the query keys need to strictly match when calling useQuery. You could manually prime the cache after prefetching and create one entry per id.
Or, with select, you would get a useSelector like api:
but you have to tag around all ids for the query key, and every refetch will still fetch all items