Tag invalidation without subscribers #5050
-
Hej there! Here is a flow that I find confusing:
What I don't understand is why the cached data is used even though it was invalidated. So no re-fetch for invalidated data is done 😢. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
I don't understand this part - can you clarify? Is the question about whether a re-fetch is (or is not) occurring when a tag invalidation happens, or about the caching behavior? Note that we designed RTKQ to keep the last successful request result as |
Beta Was this translation helpful? Give feedback.
I think the problem what we have is, that we relied on the fact, that
initiate
waits for the re-fetch result. But as you stated and as I understood it, it may return the cached data 👍 So we would need additional logic to handle that waiting for the actual result here.So we go into the direction to use the
initiate
part withforceRefetch
.Not the best solution, but it works for now.
We will remove the
initiate
code in the near future anyways and use hooks then. It's a lot easier.Thanks for your help!