-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
dispatching abortRequests without a requestKey should abort all requests #365
Comments
@iwan-uschka to abort with requestKey you would need to use this API: So this is like feature request, we could support for example But I feel that maybe you need something else, maybe you should use batched request? See https://redux-requests.klisiczynski.com/docs/tutorial/2-batch-requests |
Thx @klis87 for getting back on this one. In my scenario the user can load items of several categories manually by clicking on the specific category links. Depending on the network situation categories can load simultaneously. The calls need to be canceled if the user is gonna leave the view. Batched requests doesn't seem to fit in here but thx for the hint. I thought the easy way initially about canceling the requests: cancel all no matter what. And it would have been nice to just call something like I created this ticket anyway, not as a feature request but as a bug report because i thought https://redux-requests.klisiczynski.com/docs/api-reference/abort-requests/ would tell me in a top down order (hierarchically) how to cancel requests (globally to specifically) and So i don't wanna ask to implement this as a feature (for me 🙃 ). But feel free to do so or feel free to update the docs like
Cheers & Thx!!! |
@iwan-uschka yes, batched requests wont fit, they are dedicated for a scenario when you need to make several requests at the same time, but if situation is dynamic or if you need to fetch more data gradually, then Anyway, you don't need cache used keys. You can derive them from the state.I won't test this, but I guess sth like that will work: const getUsedRequestsKeys = (state, { queryType }) =>
Object.keys(state.requests.queries).filter(v => v.startsWith(queryType)).map(v => v.replace(queryType, '')); You could do similary thing for mutations. |
Hey @klis87 thx for your response. I must admit i don't know what Feel free to close this ticket if you decide not to change the behaviour of |
@iwan-uschka just global redux state, suggested |
Always having "store" in mind when talking about redux and "state" when talking about components. Thx for pointing that out. |
Taking the example from https://redux-requests.klisiczynski.com/docs/api-reference/abort-requests. If i call
i am not able to abort requests
FETCH_BOOKS
having a specificrequestKey
. Is this the wanted behaviour or a bug?In my case i dispatch
FETCH_BOOKS
several times in a row with a differentrequestKey
but want to abort all requests by dispatchingabortRequests
once without having to know and to set the request keys being used.The text was updated successfully, but these errors were encountered: