TanStack / TanStack/store

[Feature request] Add option for persistent state

Open
#165 2 comments 22 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
893
Forks
114
Avg merge
8d 14h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. First clarify whether persistence belongs in the core library or a plugin, which storage targets and serialization/API are supported, then define tests covering state restoration at application boot and updates without input-driven churn.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.