Replies: 1 comment 1 reply
-
Hi @pvomacka! This looks like a bug, can you create an issue for it? |
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
-
Hi,
I would like to ask you whether the below described behavior is bug or whether I use the useInfiniteQuery incorrectly?
The behavior of the app: I have list of items (ie. projects), it is fetched page by page (lets say that page is 3 items long). So, my
getFetchMore
function returns page number (to be sent to backend to know which data send back) and false when there is no more data to fetch. This works properly when being on page with list. But there is a page in the app where I can delete a project from the list and go back to see updated list of projects.The issue: In case there are 7 projects, that means 3 pages and the last page has only 1 project,
useInfiniteQuery
sends 3 requests with param?page={1,2,3}
. Then I go to another page, remove 1 project. And go back to the list.useInfiniteQuery
sends 3 requests with params?page={1,2,false}
. The issue is that it sends alsofalse
as param instead of stopping sending requests. I guess that it is caused byqueryCache
which remembers number of pages used for the currentqueryKey
, and it tries to refetch the same number of pages.I tried to simulate the issue in codesandbox.io. Steps to reproduce in sandbox:
?page=false
are visible in developers console's network tabNOTE: refresh the sandbox for reproducing the issue again
Link to sandbox: https://codesandbox.io/s/ancient-snow-0pqdp?file=/pages/index.js (Modified example from your documentation)
Thank you,
Pavel
Beta Was this translation helpful? Give feedback.
All reactions