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

Adding async storage helpers #127

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JDMathew
Copy link
Contributor

@JDMathew JDMathew commented Aug 5, 2022

Added helpers for async storage

Closes: #130

@JDMathew JDMathew self-assigned this Aug 5, 2022
@JDMathew JDMathew added enhancement New feature or request blox app labels Aug 5, 2022
@keithluchtel
Copy link
Contributor

keithluchtel commented Aug 5, 2022

Are these needed for anything in particular at this point?

@JDMathew
Copy link
Contributor Author

JDMathew commented Aug 5, 2022

Yeah, I'll be using the string values when storing the mode but I thought I may as well add all the helper functions at once

@keithluchtel
Copy link
Contributor

I thought we were going to put the preference in Zustand?

@JDMathew
Copy link
Contributor Author

JDMathew commented Aug 8, 2022

My vision was that Zustand would persist Aysnc storage functions that get the mode. Zustand would also call Async storage functions that set the mode. These mode storage functions call generic asyn helper functions to set and get values. This PR is adding those generic async functions

@keithluchtel
Copy link
Contributor

I was thinking we'd use the built-it persistence middleware to handle storing the store to AsyncStorage and wouldn't need these helpers: https://github.com/pmndrs/zustand/blob/main/docs/persisting-store-data.md

@JDMathew
Copy link
Contributor Author

JDMathew commented Aug 8, 2022

I was thinking we'd use the built-it persistence middleware to handle storing the store to AsyncStorage and wouldn't need these helpers: https://github.com/pmndrs/zustand/blob/main/docs/persisting-store-data.md

Right, I was seeing persist as just hydrating now handling the storage with getters and setters. Will use this approach.

Is it worth us having these async helper functions in the codebase anyway?

@keithluchtel
Copy link
Contributor

Let's keep this PR around and can merge it through when we have a valid use-case for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blox app enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Added Async storage helpers
2 participants