useInfiniteQuery, refetch certain page
is it possible to fetch certain page instead of all pages? because i plan to insert some page in the middle, and fetch them
4 Replies
quickest-silver•3y ago
well, there is a feature in v4 that does this, but have removed it in v5 because it's not a good feature 🙂 you need to refetch all pages to avoid getting into inconsistent states
extended-salmonOP•3y ago
oh, i'm using latest v4, how do i do that?
frail-apricot•3y ago
In the filters you pass to
invalidateQueries, you can add a refetchPages function: https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientinvalidatequeries
Use this function to specify which pages should be refetched
QueryClient | TanStack Query Docs
QueryClient
The QueryClient can be used to interact with a cache:
quickest-silver•3y ago
I cannot recommended to use that feature as it's deprecated and will be (= has already been) removed in the next major version