Skip to content

[Feature request] Add option for persistent state #165

@nathantaal

Description

@nathantaal

Describe the Feature request

It would be great if TanStack store got an option to persistent state between application boots. This takes away the hassle of saving all data that needs to be persistent, to the store but also to disk. I know this pattern from Vuex and later Pinia, but now being in a situation where I'm unable to use my favorite JS framework, I am able to use introduce new things like state management (new to on of the projects i'm currently working on). I would like doing this with a state management tool that has an API that I like, and I also value the ability to use it cross framework as well. But currently, I'm missing the option to make the state persistent in TanStack Store. I can get close by using signals like effects, pseudocode:

effect()=>(
   store.setItem('var1', var1);
)

I use a similar pattern to retrieve state at app boot. But this is of course far from optimal and would for example cause issues if put on an input component directly, then you'd have to debounce the effect or something. In short; it would probably be better if implemented in the library (or as a plugin) so that users needing persistency don't have to re-invent the wheel or implement sub-optimal solutions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions