🚀[FEATURE]: Support async storage in storage plugin #1906
Replies: 4 comments 1 reply
-
@AllySummers Hello, what do you think about create PR for us copy paste from https://github.com/kxc0re/store/tree/async-plugin/packages/async-storage-plugin |
Beta Was this translation helpful? Give feedback.
-
I did have a go at making a plugin although had a very hard time understanding the code in both |
Beta Was this translation helpful? Give feedback.
-
@markwhitfeld maybe we can create documentation about create plugins for NGXS? |
Beta Was this translation helpful? Give feedback.
-
Hey, I'm pretty sure this is very wrong but my first attempt at making a plugin. https://github.com/AllySummers/ngxs-store/tree/feature/async-storage-plugin I wasn't able to get it working as a local install (like installing from the @ngxs dist folder), but thought I'd put here in case you can help me out on getting it to work like that. Unfortunately I would work more on it now but I have to go to bed for work and likely won't have a chance to work on this for a while. This is the error I was getting, so if you're able to help me resolve this for next time, that would be appreciated:
Edit: You can see a repo with how I was attempting to use it locally here: https://github.com/AllySummers/ngxs-async-demo-project |
Beta Was this translation helpful? Give feedback.
-
Related issues: #896 #221
Related PRs: #669 #814 #842
Relevant Package
This feature request is for @ngxs/storage-plugin
Description
The current @ngxs/storage-plugin does not support asynchronous or observable-based storage engines, making it difficult to use NGXS and data persistence in PWAs.
Describe the problem you are trying to solve
Allow use of NGXS with offline persistence storage options for PWAs.
Describe the solution you'd like
Either:
Describe alternatives you've considered
Extra notes
This implementation could possibly be simplified by using this npm package @ngx-pwa/local-storage as it implements a localStorage-like API for Indexed DB.
It could also simplify the implementation by using localForage.
The lack of up to date and stable async/observable-based storage options is makes it very hard to consider NGXS as a state management library when PWA support is absolutely necessary, especially when Akita supports and mentions this on the wiki
Beta Was this translation helpful? Give feedback.
All reactions