How to show loading with useInfiniteQuery for first page? #4286
Unanswered
aliakbarazizi
asked this question in
Q&A
Replies: 1 comment 7 replies
-
There is only one cache entry that contains multiple pages. Internally, the refetch is one opaque operation. I don't think there are even re-renders until all fetches are done, as that would potentially show non-matching / invalid data / duplicate data. So |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi I'm try to use
useInfiniteQuery
but I'm little confused to how show proper loading.in the document it suggest
isFetching && !isFetchingNextPage
This is great and work perfect except for one exception.
I have 2 different loading, one for first page that come in top of the list and the second one is for loading next page that come in bottom of the list.
When the query become active again and I have more than one page in the cache, react query tries to load all the pages and for all of them the
isFetching && !isFetchingNextPage
is true. So I'm showing loading at the top of the pages for fetching pages 2,3,4... and since it can be lot of pages there is a lot of time the loading visible.I want to make refeching other pages in background ( not the first page so the user can know he is seeing new data )
So how I can show loading for these condtion
Thank you
Beta Was this translation helpful? Give feedback.
All reactions