-
Notifications
You must be signed in to change notification settings - Fork 120
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 support for localstorage (#68) #69
base: master
Are you sure you want to change the base?
Adding async support for localstorage (#68) #69
Conversation
@ernestomancebo What issue are we trying to address here? I'm torn on performing async operations in a meta-reducer. |
I'm addressing for the item 68 (#68), not sure why didn't linked on the title. The idea behind this is to call a function after the update state promise completes. Any suggestion to improve the design will be appreciated. |
New to your module. Noticed the similar "ngrx-store-ionic-storage", but glad to see you've made it possible in yours to use async operations too. Will update after testing and using in own app! Thanks 👍 |
@btroncone could you explain why? Am new to this all and don't intuitively understand why you wouldn't want async? |
I would like to expand on the explanation as there has been 4 or 5 years and things got updated. TLDR: localstorage can be cleaned up, so solutions could be: 1. use indexedDB over localstorage and 2. use a mobile device native storage when the web code is used for a hybrid mobile application. Both requrie async / Promise Long read. Why we want async for a web (PWA) app.
Why we want async for hybrid (both web and mobile) apps
Why wanting this from ngrx-store-localstorage and not create an alternative
Why I think ngrx-store-localstorage is close enough
|
Wrapping the update operation of the local storage on a
Promise
, which when completed calls theresolveOnUpdate
function and pass down the key and new value as an object. When there's an error, calls thecatchOnUpdate
and pass the error.Those functions are wrapped on the optional attribute
asyncOperations
in the config object and are defined as follow:Please review and let me know if any enhancement needs to be done