Recoil
Recoil copied to clipboard
How to clear all atomic states and restore them to default values
I have a requirement now Users have multiple accounts The requested data for each account is globally stored using recoil To enable components to be freely and infinitely split without worrying about data transmission But when the user switches accounts These data caches seem to have lost value. I hope to clear all the data caches when switching accounts and welcome new account data At present, it seems that there is only a solution for refreshing the page, and the experience is not very good Perhaps all I can do myself is manually integrate all recoil data and batch clear it
Here is my solution for combining recoil to cache network data https://github.com/SGDS666/single_request
I believe you can reset the data by referring to this document: https://recoiljs.org/docs/guides/dev-tools/#time-travel. You just need to go back to the earliest snapshot when switching accounts.