Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stored values not restored #5

Open
5 tasks done
adamjkb opened this issue Aug 21, 2023 · 1 comment
Open
5 tasks done

Stored values not restored #5

adamjkb opened this issue Aug 21, 2023 · 1 comment

Comments

@adamjkb
Copy link

adamjkb commented Aug 21, 2023

Describe the bug

Values aren't actually restored from cache/localstorage because the return type of Preferences.get doesn't match the react-native async storage API's.
As a result parseData function always returns the fallback.

Essentially here it should be something like persistedData.value

const parseData = (persistedData: any, fallback: any) => {
try {
if (persistedData)
return JSON.parse(persistedData)
}
catch (_err) {}
return fallback
}

Reproduction

N/A

System Info

N/A

Used Package Manager

n/a

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@productdevbook
Copy link
Member

I'll take a look at this for a while. I was using it in a project, I'll check it out when I get back there. Or it would be nice to create a demo area here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants