Why does useInfiniteQuery
remember the current page even when it unmounts and remounts?
#7095
Answered
by
devonpmack
devonpmack
asked this question in
Q&A
-
This behaviour is quite odd. If you go to component with an infinite query, go to next page, leave and then come back, it still remembers the page number you are on. I would expect the current page to reset back to zero and it to keep the cache of pages when unmounted. I couldn't find a good way to work around it without just disabling caching. Maybe this should be a setting like "resetPageOnUnmount: true"? |
Beta Was this translation helpful? Give feedback.
Answered by
devonpmack
Mar 12, 2024
Replies: 1 comment 2 replies
-
What's a "current page" in terms of an infinite query? I think I don't understand the scenario... can you show a minimal reproduction? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved it by keeping a page number in state and using that to index data.pages 💯 Thanks