Rafael Hengles
Explore posts from serverssetstore mutate more than one property in one call
Strange, I tried a small example and it did not recreate the components, I don't know yet what is causing it to recreate in my more complex app
https://playground.solidjs.com/anonymous/41fd82b2-3381-46aa-b080-ff32c4afb4f0
12 replies
how to avoid child component re-creation with For
also this is not typechecking right to me (at least in vscode, in which TS is very fragile to me using win10 with wsl (also with every project, not just Solid))
When I pass the "valueToChange" string key of the property, TS complains that it "is not assignable to parameter of type 'never'."
16 replies
how to avoid child component re-creation with For
you cannot call setStore() and return a object with the changed value
you must use each parameter of setStore() to walk down the path to the property you want to change
instead of setStore( item => item.id === id, obj => { ...obj, valueToChange } )
you should call setStore( item => item.id === od, "valueToChange", valueToChange )
16 replies
how to avoid child component re-creation with For
I just tried using the 'setStore' call to mutate the object and return the same old tuple, but now the child component is not updated
I guess it sees the same object and assumes the element is already up-to-date
16 replies
how to avoid child component re-creation with For
This page[0] in particular says that Solid "strongly recommends immutable patterns"
[0] https://www.solidjs.com/tutorial/stores_mutation
16 replies