S
SolidJS14mo ago
PureSoul

Cant Change Store with unwrap

when I first unwrap the store and then I set the value its not updated: reproducible example: https://playground.solidjs.com/anonymous/650e10ae-8881-43d4-b1ff-7478e1a1c894
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
4 Replies
mdynnl
mdynnl14mo ago
it's expected, stores (like signals which they are implemented under the hood) relies on referential equality and stores merge top level props. but you shouldn't be doing that anyway. stores are immutable (kinda) in the sense that if you don't go through the setter, nothing updates in the eyes of reactivity. you can use path setter or combine with produce for mutable-like setting setStore("fields", 0, "editable", false) setStore("fields", produce(f => { f.editable = false }))
PureSoul
PureSoul14mo ago
Thanks, does after unwrap and setting value to unwraped data and setting again, not change the store value? example in this playground value is not changing: https://playground.solidjs.com/anonymous/a4712b17-adf5-4725-b390-e5b65156959b
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
mdynnl
mdynnl14mo ago
it changes the underlying value but wont trigger reactivity like similarly
signal().a = true
setSignal(signal())
signal().a = true
setSignal(signal())
https://www.solidjs.com/docs/latest/api#updating-stores or maybe look through the tutorial https://www.solidjs.com/tutorial/stores_nested_reactivity and the rest of it
PureSoul
PureSoul14mo ago
Thank you so much.