Replies: 1 comment 1 reply
-
Changing the query arg passed to a hook will result in creating + fetching a completely different cache entry. The "arg change configuration" is a reference to the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Trying to use the new infiniteQuery endpoint, and running into some confusion.
The scenario is that we have a list of items with a "Load More" button at the end. When clicking Load More we use the fetchNextPage handle.
We then have two pages in the cache, which is fine.
The confusing behavior happens when we then sort the list, which results in changing one of the queryArgs (sort order is a query arg).
Am I right that RTKQ is then supposed to do two fetches sequentially, one for each page in the page? I'm basing that on the docs, here:
https://redux-toolkit.js.org/rtk-query/usage/infinite-queries#refetching
It says:
"When an infinite query endpoint is refetched (due to tag invalidation, polling, arg change configuration, or manual refetching), RTK Query will try to sequentially refetch all pages currently in the cache."
Its the "arg change configuration" part that throws me off a bit. It might read as "when a query argument changes", but thats perhaps not what it means?
I only see one fetch and on subsequent entry in the cache, so the number of items in the list will then vary depending on the sort order.
Beta Was this translation helpful? Give feedback.
All reactions