SolidJSS
SolidJSโ€ข3y agoโ€ข
6 replies
aryzing

Setting a deeply nested store property changes produces new reference for property's parent?

Wanted to confirm the observed behavior I'm seeing when modifying deeply nested store properties.

Given a store with the following structure: createStore({ a: { b: { c: "end" } } });, a
createEffect
that references either the store or store.a will not re-run when
c
is changed, but will re-run when using store.a.b or store.a.b.c..

It was surprising that the effect ran when referencing store.a.b . The modification to
c
is done with setStore("a", "b", "c", "rand" + Math.random());.

Does that mean that solid will produce new parent objects when modifying a child?

Playground: https://playground.solidjs.com/anonymous/6f53203a-65d1-407d-9c24-f3f526702e0d
Quickly discover what the solid compiler will generate from your JSX template
Was this page helpful?