Untrack on store arrays

Yesterday I had some misunderstandings around createEffect and stores. Today I probably have similar misunderstandings around untrack. My assumption was that, e.g.
createEffect(() => {
const prevArr = untrack(() => prevConfig.arr);
setPrevConfig("arr", 0, { x: 1 });
});
createEffect(() => {
const prevArr = untrack(() => prevConfig.arr);
setPrevConfig("arr", 0, { x: 1 });
});
would not re-trigger the effect. That, however, seems not to be the case. I'm sure there's a good reason for it. It feels quite unintuitive to me though. https://playground.solidjs.com/anonymous/fbb65302-6799-436c-9abd-287968aaa708
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
3 Replies
REEEEE
REEEEE2w ago
The problem is that each property of a store is a signal, so really all you're doing with that untrack is stopping changes to the "arr" signal from triggering the effect but not the properties within "arr" that could also be signals or even the length
lemonad
lemonadOP2w ago
So there’s no way to untrack arrays in stores? I tried untracking the length and each individual index before reading but that did not help.
webstrand
webstrand2w ago
it sounds like you really want unwrap instead? To suppress the deep reactivity

Did you find this page helpful?