question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to clear persist stores at logout?

See original GitHub issue

Hi,

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: image

What would be the best approach to clear all the stores?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
Disane87commented, Jan 12, 2021

the possiblity is given even if actually many users have their own account on the device

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 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.

But if I do not persist the data I’m worried about the usage/traffic of firebase.

I will create an issue about caching, this wasn’t the in our focus for a long time.

Thank you! 👍

0reactions
fritzschoffcommented, Jan 12, 2021

the possiblity is given even if actually many users have their own account on the device

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.

But if I do not persist the data I’m worried about the usage/traffic of firebase.

I will create an issue about caching, this wasn’t the in our focus for a long time.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found