redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

Retries are not cleared after calling api.util.resetApiState

Open ayushsharma82 opened this issue 3 years ago • 2 comments

Hi @phryneas ,

I ran into this bug today by chance while monitoring a failing API request. I'm using the retry function combined with baseQuery provided by RTK Query. The "retries" are not automatically cancelled when we call api.util.resetApiState. Usual behaviour should be to first cancel all pending retries and then reset the API state.

Let me know what you think about this.

Regards, Ayush

ayushsharma82 avatar Nov 27 '21 16:11 ayushsharma82

Hmm, I can see your point. But I'm not sure how easily that would be doable. I'll add an "enhancement" label and target this to v1.8 - I'll need some time to think this through.

phryneas avatar Nov 27 '21 22:11 phryneas

Hmm. I'm looking at this, and yeah, not sure how easy it would be. Looks like retry() is used to wrap the base query, but that's a very separate thing from "dispatch the resetApiState action".

Also not sure this is worth adding to 1.9, given that resetApiState is a rare use case.

markerikson avatar Aug 21 '22 23:08 markerikson