Skip to content
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

[Feature request] Add option for persistent state #165

Open
nathantaal opened this issue Feb 6, 2025 · 0 comments
Open

[Feature request] Add option for persistent state #165

nathantaal opened this issue Feb 6, 2025 · 0 comments

Comments

@nathantaal
Copy link

nathantaal commented Feb 6, 2025

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.

@nathantaal nathantaal changed the title Add option for persistent state [Feature request] Add option for persistent state Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant