Nested Stores not tracking with `trackDeep`/`trackStore`
I have a top-level store created in parent component A. This store contains an array of objects, like so:
After this store is populated with objects during component A's initialization, each object is then passed as a prop to a child component B:
Now in component B, a nested store is created for easier fine-grained reactivity:
When values inside
obj
are set within component B, effects inside component B react accordingly (using trackStore
plugin, or directly depending on a specific value).
However, effects in component A do not run on updates that trigger component B's effects:
Could anyone advise on what I may be doing wrong here? Is there something wrong with passing store values as props and then creating a nested store based on that prop?1 Reply
I am not familiar with
trackStore
, but for my own case I just dumbly iterated the leafs of the tree so that everything is tracked in that scope. I suspect this is not how you are supposed to do it, but at least it works 😛
https://github.com/chris-kruining/calque/blob/dc30ebb35e36ea34ea7e368b4f3b5636aa1c0881/src/features/file/grid.tsx#L49