store
store copied to clipboard
🚀[FEATURE]: use both sessionStorage and localStorage
Feature Request
In my application, I need to use sessionStorage and localStorage to persist related data.
storage-plugin
now only supports one storage engine.
Versions
* ngxs: v3.2.0
* @angular/core: v6.0.0
Repro steps
none
Observed behavior
one storage engine supported
Desired behavior
multi storage engine support
you want to store the same data in LocalStorage and SessionStorage?
not exactly, different data in different storage.
Is it possible to achieve with two custom storage engines?
Not sure
I'd like this as well, so that the storage engine can be specified within the @State decorator. I think for most people's applications, they are going to want auth information and other application-level stores to be shared across tabs in LocalStorage as opposed to SessionStorage which would cause users to log in again with each new tab they opened. While other information (current route, resources still in the draft stage, etc), is appropriately placed in SessionStorage - since it's data that is still only specific to a given tab.
https://www.npmjs.com/package/@ngxs-labs/data
Great news! v3.8.0 has been released and it includes a fix for this issue. We are closing this issue, but please re-open it if the issue is not resolved. Please leave a comment in the v3.8.0 release discussion if you come across any regressions with respect to your issue.