-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
Are these needed for anything in particular at this point? |
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 |
I thought we were going to put the preference in Zustand? |
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 |
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? |
Let's keep this PR around and can merge it through when we have a valid use-case for them. |
Added helpers for async storage
Closes: #130