What is wrong with this reactive select list?
https://playground.solidjs.com/anonymous/886c5e97-4d2e-427f-abf0-95df02ab0c71
The first select list in the playground works. But the second doesn't. If you click on an element and then another, there will be 2 selected elements.
Any idea as to why is this happening for the second example but not the first?
4 Replies
You need to replace the object in the store
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Thank you so much!!!!
Btw would you mind to explain why there was such a behavior? (clicked first element, first element selected, clicked second element, first and second element selected with both same labels).
Don't really understand what was going on and how we fixed it
The behaviour shown is kinda strange, but, when setting a store or signal, they check for equality before notifying their observers (if the current value is equal to their previous value, nothing updates), and js objects are done by reference so even if the contents have changed the reference is the same when you set it