New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTKQ: Delayed invalidationBehavior issue with long running queries #4347
Comments
yeah, this is a 2.0 change - you can set |
@EskiMojo14 I get the idea behind the 'delayed' option as I also experienced issues with the 'immediate'. However, I feel like this is delayed a bit too much if you know what I mean. Why would the invalidation of a query wait for another query to finish loading? |
I have some long-running queries in a production environment and can't do much about it. They kind of run in the background and are not blocking user actions with other parts of the UI. When the user does some actions that invalidate the tags of those immediate queries, they are not being re-fetched until this long-running one finishes loading. I know I can fix this case by changing to 'immediate' invalidationBehavior, but I really would like to find a solution that does not require that change |
I think there was some discussion in the original issue around possibly trying to make the behavior more targeted in which queries it waits for, but we opted to defer that aspect in order to get 2.0 out the door. |
Issue description
Whenever there is a pending query on some endpoint 'A', invalidation of cache (re-fetch when subscribed) on endpoint 'B' is only triggered when the endpoint 'A' query finishes.
Consider a scenario where you have two queries getPosts and getMyPosts. Let's assume that getPosts takes around 25 seconds to finish and getMyPosts returns data immediately (200ms).
Steps to reproduce:
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: