store icon indicating copy to clipboard operation
store copied to clipboard

🚀[FEATURE]: use both sessionStorage and localStorage

Open scott-ho opened this issue 6 years ago • 6 comments

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

scott-ho avatar Oct 09 '18 08:10 scott-ho

you want to store the same data in LocalStorage and SessionStorage?

splincode avatar Oct 09 '18 08:10 splincode

not exactly, different data in different storage.

scott-ho avatar Oct 09 '18 08:10 scott-ho

Is it possible to achieve with two custom storage engines?

YogliB avatar Jan 15 '19 07:01 YogliB

Not sure

splincode avatar Jan 15 '19 07:01 splincode

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.

Senneseph avatar Aug 20 '19 15:08 Senneseph

https://www.npmjs.com/package/@ngxs-labs/data

splincode avatar Dec 18 '19 21:12 splincode

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.

markwhitfeld avatar Mar 29 '23 14:03 markwhitfeld