Replies: 1 comment 2 replies
-
that is the expected behaviour. When the query errors, it has no data. The next time you try to use the query, it will be in loading state because it has no data to show. would you like to keep showing the error while the query is loading? |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How to tell when a query has switched to
fetchStatus === 'fetching'
for the first time?The idea here is to display a spinner only on the first time the query attempts to fetch data. Regardless of whether it fails or succeeds, the UI should remain unchanged when the query fetches again. This seems to be tricky if the query fails and its
status
is set toerror
on its first try, as subsequent fetches will set the status back toloading
.I tried
isInitialLoading
, which sounded promising, but turns out that if the first request fails and data isn't loaded, subsequent requests will again setisInitialLoading
totrue
.So, how to tell when a query is fetching for the first time?
I've noticed there's a
failureCount
prop: would we need to do something likeisInitialLoading && failureCount === 0
to detect when a query is fetching for the first time?Beta Was this translation helpful? Give feedback.
All reactions