fungible-systems / micro-stacks-monorepo

MIT License
4 stars 2 forks source link

localStorage wiped out upon sign out #21

Open aviculturist opened 3 years ago

aviculturist commented 3 years ago

Wiping out localStorage upon sign out makes good sense but some apps use it for state other than stacks state, would be great if we could just remove the micro-stacks-specific localStorage items.

https://github.com/fungible-systems/micro-stacks-react/blob/7f6835a1e6ab56b4b872b97babd54285fce2d9e5/packages/react/src/hooks/use-auth.ts#L43

aviculturist commented 2 years ago

Wrapping handleSignOut I was able to solve this:

const handleHandleSignOut = () => {
    const darkMode = localStorage.getItem('darkMode') || '';
    handleSignOut();
    if (darkMode !== '') {
      localStorage.setItem('darkMode', darkMode);
    }
  };