tehquickness
tehquickness
SSolidJS
Created by tehquickness on 10/8/2023 in #support
Item in store array being overwritten
It feels kind of like pointers. If I take a proxy object and assign it directly to selectedElement, the next next selectedElement is assigned , it overwrites the original element still in the array. Assigning null clear clears the assigned element or using spread creates a brand new object
8 replies
SSolidJS
Created by tehquickness on 10/8/2023 in #support
Item in store array being overwritten
My guess is that elem is a proxy object so when it gets assigned to selectedElement which was also a proxy object, it tries to replace in the array maybe
8 replies
SSolidJS
Created by tehquickness on 10/8/2023 in #support
Item in store array being overwritten
Spread operator does indeed fix it!
8 replies
SSolidJS
Created by tehquickness on 10/8/2023 in #support
Item in store array being overwritten
Interestingly enough, if I do this: batch(() => { setState("selectedElement", null); setState("selectedElement", elem); }), It seems to work
8 replies
SSolidJS
Created by tehquickness on 10/8/2023 in #support
Item in store array being overwritten
setState("selectedElement", elem); When a click happens I find the clicked element from state.elements, then I use the setState above
8 replies