Index block does not notice change in a store
for some reason, the loop does not notice the change in the store.
i've tried with signal and got the same result.
sc: https://pastebin.com/WANfg1Mp
8 Replies
https://www.solidjs.com/docs/latest/api#updating-stores might help you
also, if you prefer to mutate https://www.solidjs.com/docs/latest/api#produce exists
produce
works. hm....in case it wasn't obvious, with
produce
, it'd be just prev.items[idx].count++
set("items", idx, "count", v => v + 1)
with path, and produce
can be used anywhere nested
e.g anywhere except the leaf setter v => v + 1
in abovetobe clear, with my original code,
Index
does notice on item removed and added to the list. but not an individual item.
produce
does exactly what i need. but IDK why it's necessary.
there is also createMutable
and modifyMutable
which remove the need for produce
. i guess, i'll use them instead.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
you might wanna dig up opinions on
createMutable
in this discord, IIRC it's planned to be moved outisde core for reasonsi thought, it already is. its in the tutorial afterall.
https://www.solidjs.com/docs/latest/api#createmutable
like search
createMutable
in this server