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.

Unexpected token c in JSON at position 0

See original GitHub issue

I’ll try to post more but I’m getting this when values are loaded between windows

Uncaught SyntaxError: Unexpected token c in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.current (:8500/Users/burton/projects/polar-app/packages/polar-bookshelf/node_modules/use-persisted-state/dist/use-persisted-state.js:1)
    at e (:8500/Users/burton/projects/polar-app/packages/polar-bookshelf/node_modules/@use-it/event-listener/dist/event-listener.js:1)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:12
  • Comments:7

github_iconTop GitHub Comments

10reactions
scscgitcommented, Jun 23, 2020

I also stumbled upon this, and I believe this is a really severe issue, as any app in the production can completely break down, making the user unable to access it at all if they had previously accidentally stored a variable in the browser using the native JS localStorage, and there’s no way for developers to even notice this hazard during the development, for example if they switch the libraries and aren’t lucky enough to keep the old state. Could you please mention this severe limitation in the Readme, so that people don’t mistakenly use this library as long as this issue is known? I’ve been directed to this project from somewhere, but it seems the library https://github.com/astoilkov/use-local-storage-state is generally a better choice for any similar purpose. Maybe the projects could be even merged to serve as a universal solution if there’s no plan to provide anything custom.

2reactions
astoilkovcommented, Nov 15, 2020

use-local-storage-state author here. I can confirm that this issue doesn’t exist in my implementation. I also have been actively maintaining it for the past 7 months and will be happy to see new people using it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token C in JSON at position 0 - Ionic 2 Http GET ...
I am getting the error SyntaxError: Unexpected token C in JSON at position 0 . I am also assuming that the error is...
Read more >
What Is JSON and How to Handle an “Unexpected Token” Error
“Unexpected token < in JSON at position 0” is the error that I have seen most throughout my time of working as a...
Read more >
How to Fix SyntaxError: Unexpected token < in JSON at ...
This guide will help to fix SyntaxError: Unexpected token < in JSON at position 0 . This guide also applies to these other...
Read more >
Unexpected token C in JSON at position 0 ---- List already exists
Hi folks, In a Sharepoint site, I am trying to create a list from an excel spreadsheet that contains data from Microsoft form...
Read more >
Unexpected token < in JSON at position 0 - Dave Ceddia
The exact text of this error will differ depending on what the server returned. The token and the position may vary, but the...
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