Skip to content
Discussion options

You must be logged in to vote

I don't think there is. if you unmount your component during every background refetch, the scroll position is gone. it also means that every time you focus the window (unless you turn that feature off or customize staleTime), your component would unmount and a loading spinner is shown.

a better ux would likely be to show a background loading spinner in addition to the stale data, and maybe a success toast after the data has been fetched to show the users that they are now seeing new data. but the stale-while-revalidate principle react-query is built upon usually leads to a better ux if you keep showing stale data instead of a loading spinner while background updates are happening. otherwi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@github-changhyeon
Comment options

Answer selected by github-changhyeon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants