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.

Parsing local storage data in React Native

See original GitHub issue

As the title says I upgraded to 0.5.0 and it crashes here

[Unhandled promise rejection: SyntaxError: JSON Parse error: Unexpected identifier "object"]
* [native code]:null in parse
- node_modules/offix-client/dist/offline/OfflineStore.js:79:45 in <unknown>
- node_modules/offix-client/dist/offline/OfflineStore.js:32:27 in step
- node_modules/offix-client/dist/offline/OfflineStore.js:7:13 in <unknown>

It looks like the getOfflineData function doesn’t properly handle invalid data from the store. I’m using 0.5.0 on react-native (expo) with AsyncStorage.

Edit: It actually crashes using AsyncStorage no matter what now. It isn’t just with old data. I cleared the data on the simulator and the result is the same. This worked in the previous version without problems.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
evelantcommented, Jun 12, 2019

Unfortunately my team has decided not to use apollo/graphql for our latest project so I won’t have time to contribute here for some time. I think this issue can be closed since it sounds like the storage abstraction should render it a non-issue.

0reactions
wtrockicommented, Jun 12, 2019

@AndrewMorsillo Thank you so much for the update!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parsing JSON file from LocalStorage in to react-native
Hi the data prop of FlatList component accepts only array of values. But you are generating an object in your info.json file.
Read more >
React localStorage: set and get items with hooks - CopyCat Blog
Learn the basics of React localStorage. In this tutorial, we'll focus on how to use the localStorage storage type with React and hooks....
Read more >
How to Use localStorage with React Hooks to Set and Get Items
localStorage is a web storage object that allows JavaScript sites and apps to keep key-value pairs in a web browser with no expiration...
Read more >
Using localStorage with React Hooks - LogRocket Blog
Learn how using localStorage with React Hooks can persist user information in browser storage and share logic between multiple components.
Read more >
Local Storage in React - Robin Wieruch
What's important to note is that the data stored in the local storage should be in a JavaScript string format. For example, if...
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