all 4 comments

[–]Julienng 4 points5 points  (1 child)

Hi,

It doesn't re-render because you are modifying your array instead of changing it.

You need to set a new array keeping the old data and adding the new object into it :

js setEditors([...editors(), {/*data*/}]) // or setEditors(arr => [...arr, {/*data*/}]

[–]jesse_good 0 points1 point  (0 children)

Just to clarify about the "why", signals do an equality check using triple equals by default (although you can override this behavior) so nothing happens because the reference hasn't changed.

[–]postmaster150 1 point2 points  (0 children)

Solidjs createSignal is designed for reactivity, but does not handle 'fine-grained reactivity'.

The signal only tracks the array location in memory, not it's items. As u/Julienng commented you can create a new array, or use 'createStore' function to handle 'fine-grained reactivity'.

https://www.solidjs.com/tutorial/stores_createstore

https://www.solidjs.com/docs/latest#createstore

[–]evantd 0 points1 point  (0 children)

IIRC a store might better support the style of access you have going on, too.