-
I have a situation where I need to validate an user's refresh token upon visiting the web app. The particular API call, can either fail or succeed. However, I don't want the query to refetch on windowRefocus if it fails. React query automatically marks a query as stale if the API call fails even if staleTime is set to 'Infiinity', and refetches the query upon refocusing on the window. I know this can be turned off, but is this the intended behaviour? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
yes, this is the currently expected behaviour. queries that don't have data yet are always We have a similar discussion here: would |
Beta Was this translation helpful? Give feedback.
yes, this is the currently expected behaviour. queries that don't have data yet are always
stale
, so if it has an error but no data, it will be stale. You can have data and error at the same time if e.g. a background refetch fails.We have a similar discussion here:
would
refetchOnWindowFocus: (data, error) => !!error
work for you as well?