amplitude/redux-query

Cancel/Reset query

Closed this issue · 1 comments

Hi,

I'm using version 1.5 of redux-query-immutable, which just makes the library work with an immutable store, but adds no other logic.

When a component uses connect-request and gets unmounted, while a query is in flight, it correctly tries to cancel the query. Here I always get an error, because the request object in the store has no abort() method. This is due to the following lines of code:
https://github.com/amplitude/redux-query/blob/v1.5.0/src/middleware/query-advanced.js#L112
https://github.com/amplitude/redux-query/blob/v1.5.0/src/middleware/query-advanced.js#L215

The tests pass, because we artificially create the request object in the store with an abort() function, but with request.instance, only the bare request object is passed to the redux store. I think the whole request object should be stored, not request.instance.

Hi @mmalfertheiner. This was fixed with 2.0, first reported here: #68. It was not trivial to fix without a breaking change so I included it along with a bunch of other breaking changes with 2.0.