You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a long discussion in reactiflux' redux channel, starting around here.
Here is an example to reproduce the problem: bug-repro
The problem is when multiple queries are initiate()d, dispatch()d, and we then waited on, in quick succession.
Some promises will resolve "too" soon, and not wait on a previously initiated query that actually does a fetch.
The way to see this in the example posted above is clicking the button, and seeing the promises return a pending store state.
The problem is that only a single runningQuery is kept in the runningQueries cache to a query key in buildInitiate.ts.
I am running into this problem (which many other people probably don't) because I am replacing a legacy jquery app with rtk-query calls, and a lot of backend communication is done with async jquery.ajax call chains. As I was replacing these in the app (with forceRefetch: true or more refined invalidation mechanism), I realized that my await store.dispatch(api.endpoints.getCart.initiate()) promises were out of lockstep with the actual fetch() calls.
The text was updated successfully, but these errors were encountered:
The title is a bit long winded.
There is a long discussion in reactiflux' redux channel, starting around here.
Here is an example to reproduce the problem: bug-repro
The problem is when multiple queries are
initiate()
d,dispatch()
d, and we then waited on, in quick succession.Some promises will resolve "too" soon, and not wait on a previously initiated query that actually does a fetch.
The way to see this in the example posted above is clicking the button, and seeing the promises return a
pending
store state.The problem is that only a single runningQuery is kept in the runningQueries cache to a query key in
buildInitiate.ts
.I am running into this problem (which many other people probably don't) because I am replacing a legacy jquery app with rtk-query calls, and a lot of backend communication is done with async jquery.ajax call chains. As I was replacing these in the app (with
forceRefetch: true
or more refined invalidation mechanism), I realized that myawait store.dispatch(api.endpoints.getCart.initiate())
promises were out of lockstep with the actualfetch()
calls.The text was updated successfully, but these errors were encountered: