donavon/use-dark-mode

App crashing when opening two tabs

lucasMontenegro opened this issue · 0 comments

What Happened

There is an error message in the console:

Uncaught SyntaxError: Unexpected token o in JSON at position 1
    at Object.parse (<anonymous>)
    at Object.current (use-persisted-state.m.js:52)
    at n (event-listener.m.js:10)

I also put a console.log in node_modules/use-persisted-state and it seems to be parsing null as a JSON string.

How to reproduce

  1. Go to the sample app provided in the README: https://mzj64x80ny.csb.app/
  2. Open the same app on another tab and toggle the dark mode.
  3. Go back to the first opened tab and check the console.