Skip to content
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

Cache invalidation ignored? #48

Open
aivins opened this issue Feb 27, 2018 · 1 comment
Open

Cache invalidation ignored? #48

aivins opened this issue Feb 27, 2018 · 1 comment

Comments

@aivins
Copy link

aivins commented Feb 27, 2018

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?

@MrLeebo
Copy link

MrLeebo commented Sep 7, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants