cantierecreativo/redux-bees

Cache invalidation ignored?

Opened this issue · 1 comments

Nice library, everything works as expected, except for one thing I'm confused about.

Calling invalidateRequests successfully sets invalid=true in my store. However the only place in the redux-bees code where this is checked is in the hasRequestStarted selector.

I would have thought this would cause other selectors to ignore that item in the store, but that doesn't seem to be the case. Invalidating an API call effectively seems to do nothing. What is the intended usage?

If you're using the query() HOC then invalidating the request will cause the HOC to refetch, because it checks the hasStarted status which gets reset by invalidateRequests. If you're not using query() then your own provider should probably do the same thing to ensure you aren't looking at invalid data.

Example: https://codesandbox.io/s/j4152m3pq5

I built this codesandbox for a different purpose, but you might find it useful because you can visually see the effect of invalidateRequests by browsing around with the Next/Previous buttons and then clicking the "Invalidate All" button.