solidjs-community/solid-primitives

Can't add new keys to persisted stores - feature request for different defaults handing

Aperta

#748 aperta il 8 feb 2025

 (9 commenti) (0 reazioni) (1 assegnatario)TypeScript (153 fork)auto 404
help wanted

Metriche repository

Star
 (1541 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Describe the bug

  const [,setStore] = makePersisted(createStore({a: 1}), {name: 'x'})
  setStore({a: 2}) // trigger storage (because initial values are not persisted)
  const [store2, setStore2] = makePersisted(createStore({a: 1, b: 1}), {name: 'x'})
  console.log(Object.keys(store2)) // ['a']

I would expect ['a', 'b']

While I'm here: these stores are so useful and convenient! Thanks for this.

Minimal Reproduction Link

https://stackblitz.com/edit/github-cickt7r1?file=src%2Findex.tsx

Guida contributor