Tree of Signals instead of Store #2488
FritzSolms
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
For children, you could use ReactiveSet from our community-primitives, so you wouldn't need to use setChildren and create a new Set every time. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a modeling application which enables users to concurrently evolve a model tree through diagrams ad other mechanisms. This tree needs to be reactive and since performance is important, it should be fine-grained reactive. I can use stores but then I need to submit update requests through path statements starting at the root. Instead I want to have different views onto aspects of the model have handles to their respective reactive model tree elements in order to access them directly.
So the solution I am using is a Tree of signals for the various model element types. To illustrate this consider the simplified code for a simple tree where all nodes are of the same type:
Any view element can now have a direct link to the appropriate tree node within and can update that node directly without having to navigate a text-syntax based path starting from the root. As I see it , the path based approach is both cumbersome and inefficient for deep trees.
The disadvantage of this approach is, however, that one have to construct such a signal tree.
More generally, a store provides fine-grained signal support to some object graph and one would like to be able to get direct access to signal-wrapped elements within that object graph without having to apply any update through a path query.
If you feel the above is wrong or have a better way of doing this, please let me know. I am still new to SolidJS and will, no doubt, benefit from any comments.
Beta Was this translation helpful? Give feedback.
All reactions