Replies: 1 comment 7 replies
-
yes, that’s true, code for that is here: query/packages/query-core/src/infiniteQueryBehavior.ts Lines 77 to 80 in f86eb7e
pretty sure it’s not. please show a minimal reproduction. it’s very likely you that’s implicitly modifying something. maybe you’ve forgotten |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a mutation where I append a comment to the first page (
pages[0]
). In my onMutate, I cancel any ongoing refetches (if we're not fetching a subsequent page) and then refetch in onSettledMutation:
My Query:
The issue is when I call fetchNextPage() in my component, and whilst isFetchingNextPage is true, when I add a comment, and fetching completes, any comments added during this period are removed. My cursors are correct and pagination works as expected when I don't create any comments during this time.
I'm under the impression fetchNextPage() just appends a page to the pages array, however it is clearly modifying the first page. I can confirm invalidateQueries in onSettled is not the issue, as I've removed it and the issue persists. Also, I don't want to cancelQueries if we're fetching the next page.
Beta Was this translation helpful? Give feedback.
All reactions