bug: initialState function not working for deep object mutations

Aperta
#227 2 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia dal punto di ingresso createStore e dalla riproduzione collegata in CodeSandbox; confronta il comportamento documentato della funzione initialState con il risultato attuale della mutazione profonda. Traccia anche la tipizzazione dello stato esportato. Il lavoro è completo quando le modifiche agli oggetti profondamente annidati vengono aggiornate in modo reattivo e passare una funzione non fa sì che il tipo dello stato esportato sia una funzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug: Validated Help Wanted
Prerequisites
Stencil Store Version

2.0.4

Stencil Version

3.0.0

Current Behavior

According to the documentation, the initialState property can be a function that returns the actual initial state. This is useful for cases where we have deep objects that mutate, as the library is unable to track those changes otherwise. However, I have found that this feature does not seem to be working as expected.
Also, the typing is not correct - the exported state is treated as a function in case I pass function to the createStore

Expected Behavior

When using a function as the initialState, changes to deep objects should be reactive and properly tracked and updated by the library.

Steps to Reproduce
  1. Create store with the createStore function and pass a function which is return with the initialState according to the docs.
  2. Observe that changes to the deep object are not being tracked as expected.
Code Reproduction URL

https://codesandbox.io/p/sandbox/happy-kowalevski-vi29n6

Additional Information

No response

Lingua principale
TypeScript
Stelle
181
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stenciljs/store

Tutte le issue di stenciljs/store

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.