5. Resetting requests
Sometimes you might need to clear data and errors of your requests, including both queries and mutations.
You can use resetRequests action to do it. For example:
import { resetRequests } from '@redux-requests/core';
// clear everythingdispatch(resetRequests());
// clear errors and data for FETCH_BOOKS querydispatch(resetRequests([FETCH_BOOKS]));
// clear errors if any for DELETE_BOOKS mutationdispatch(resetRequests([DELETE_BOOKS]));
// clear errors and data for FETCH_BOOKS and FETCH_BOOK with 1 request keydispatch( resetRequests([FETCH_BOOKS, { requestType: FETCH_BOOK, requestKey: '1' }]),);What is important, resetRequests apart from reset also aborts all pending requests of the given types.
You can prevent it by passing 2nd argument dispatch(resetRequests([FETCH_BOOKS], false)).
Also note that resetRequests also set query pristine to true and clears cache if set
(more about caching in another tutorial).
redux-requests