-
Notifications
You must be signed in to change notification settings - Fork 19
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
Integration with browser database (e.g. localforage) for offline access #272
Comments
That problem makes sense. I use Apart from
If that doesn't work, I think I would be open to a mutation that would overwrite the state, as you suggested. |
Yes. It works! |
I have a follow up question wrt vuex-persist... Given a specific @reststate action e.g. 'restaurants/loadAll` how do you manage offline caching so that the action will not run if the data it requires is already present? Like what strategy do you use for this? |
FYI, this library will be unmaintained going forward. If you need new features or fixes, I recommend forking the repo and making changes, or finding an alternate library that meets your needs. |
My application has an offline requirement. The way I'm managing that is I have vuex store plugin which persists the store via localforage when any mutation is run.
However. The question is how to recover data from the browser database. The scenario in which this would apply is when the application is offline, causing the reststate getters to return null and any actions to reject.
My initial solution was merging state when the store is initialised. However, as you've mentioned in other conversations, this breaks the
modular
nature of the store and it relies on state being an object and not a function.So is there a recommended way of handling this? I assume that one should run a mutation, rather than a merge. However there isn't a provided mutation that simply replaces the entire store state, so that one can just take the entire store from the localforage copy and load it into the reststate store.
Can we add a mutation to support this? Should just be:
The text was updated successfully, but these errors were encountered: