Replies: 1 comment
-
that doesn't make much sense, because invalidation doesn't remove a cached result - it just makes sure that the next time this data is requested, you get a background refetch |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm using React Query for downloading files.
If the download request is successful, I want to download the file and cache it for future requests, which works great.
If the request fails, I use
invalidateQuery
on the query client so that we do NOT use the previous cached result.I do not use
refetch
because that triggers a new download every time, regardless of whether there is a cached result or not.Just wanted to confirm with you if I'm using the library the "right" way. Does my approach make sense?
My version:
@tanstack/react-query": "4.29.5
Beta Was this translation helpful? Give feedback.
All reactions