Are errors cached in react-query?
Say i have a query in my component.
and for some reason it returns an
error
.
i see that if i travel back to that component, a request is not remade, even though my staleTime
is set to 0
.
does that make sense? i thought that errors aren't saved into cache, and hence the query would be refetched?6 Replies
flat-fuchsia•2y ago
errors are indeed refetched and not cached, so if you return a rejected promise from the queryFn, the next time you get to it, yo ushould see a refetch
national-goldOP•2y ago
weird, it's not refetching for me
this is my global config:
im a bit dumbfounded tbh, hadn't found any reason it wouldn't refetch
flat-fuchsia•2y ago
show a reproduction ?
national-goldOP•2y ago
i.e a video?
flat-fuchsia•2y ago
no, a codesandbox 😂
national-goldOP•2y ago
will try a sandbox and see if it reproduces
thanks ❤️
A sandbox works as you say, probably something with my setup
gonna try and research
turned out i used a "tabs" component which didn't actually unmounted a component once it's not displayed, so the hooks weren't called again.
thanks for the help