How to clear persist stores at logout?
See original GitHub issueHi,
I use your stores to communicate with my rtdb of firebase. Now since my application has many users, the chance somebody shares a computer with another user is relativly high.
For caching I’ve persisted the stores like akita stated: https://datorama.github.io/akita/docs/enhancers/persist-state
On logout I want to clear all the stores with clearStores
:
https://datorama.github.io/akita/docs/enhancers/persist-state/#clearstore
this.auth.signOut().then(() => {
this.router.navigate(['auth/login']);
this.persistStorage.clearStore();
});
Actually this clearStore
doesn’t clear the store for that user:
What would be the best approach to clear all the stores?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
How to reset the state of a Redux store? - Stack Overflow
Simply have your logout link clear session and refresh the page. No additional code needed for your store. Any time ...
Read more >[need help] how to reset store & AsyncStorage when dispatch ...
I am using redux-persist with redux-toolkit I want to reset all state, persist data & AsyncStorage when the user dispatch logout action ...
Read more >Reset to initial data in redux store | by Weerapat Chulaket
All data in redux store will be cleared to initial state when client refresh our application on the browser or close the browser's...
Read more >How To Clear a Redux Toolkit State That's Using redux-persist ...
Step 1: Make sure the blacklist option is removed. · Step 2: Set up the link that the user will click on to...
Read more >Reset Stores | Akita - Open Source Projects Built at Salesforce
Reset Stores · { resetStores } from "@datorama/akita"; · class AuthService { · logout() { · resetStores(); · // Optionally exclude stores ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I didn’t take it as an accusation either, don’t worry. It is yes, since you can’t predict anything at your point. But IMHO a developer convinient ability to clear all rtdb store would be prefered without forcing the dev to repeat the same code over and over, like in my example injecting the authService, listen to logout$ and after that
clearNode
.My point is not the security at all, I guess I’ve lost my mind in genereous use cases you can’t handle in a generic lib. My point is only the ability to enforce a clear of the store like I would clear the akita stores.
Thank you! 👍
But isn’t that in your responsibility as a developer to handle that, since you know most likely where this app is going to be used? This shouldn’t sound like an accusation, I’m open thinking/questioning here.
I will create an issue about caching, this wasn’t the in our focus for a long time.