keepPreviousData with refetchOnMount and scroll restoration #3720
Unanswered
TommySorensen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any way to keepPreviousData, but still always refetchOnMount and also have a cacheTime set to zero and still maintaining the scroll position in a Next.js solution? It seems like the scroll position is not kept when browsing back even though the data technically is in the cache but is stale. Maybe a bug that scroll position is not persisted?
Im currently using this.:
The use-case is that we have a "product list" page that is always user specific. The products on the list is personalised every time the page is visited and will change over time the user browse on the website. So when using back button i always want the query to refetch, but i also want the query to keep the previous successful data since that will maintain the scroll position.
I'm using v: https://github.com/TanStack/query/releases/tag/v4.0.0-beta.23
Beta Was this translation helpful? Give feedback.
All reactions