amplitude / redux-query

A library for managing network state in Redux
https://amplitude.github.io/redux-query
Other
1.1k stars 67 forks source link

How can I clear all cached queries and fetch it all again after logout. #213

Closed Drnutsu closed 3 years ago

Drnutsu commented 3 years ago

I can't find the solution or the best practice for clear all entitle and queries cached after user logout the session to prevent represent previous user session info. Could anyone here guide me about how to do it ?. Thankyou for all your reply floks.

rctbusk commented 3 years ago

Hello @Drnutsu, sorry for the late reply. While not currently documented, there is a function you can import called reset, which will reset your entities.

https://amplitude.github.io/redux-query/docs/redux-actions#updateentities it works like updateEntities here and can be called the same way, just with an empty input. This will clear entities and cancel all pending requests.