Inter-widget Communication for UI #1622
Replies: 3 comments 2 replies
-
Conclusions:
|
Beta Was this translation helpful? Give feedback.
-
Making the messages created immutable is generally considered a good idea, to reduce the difficulty of reasoning about them. This very much pushes us away from the messages-as-raw-components and messages-as-entities data models. Messages as events stored in channels on a component in a dedicated channel entity should work just fine. |
Beta Was this translation helpful? Give feedback.
-
Opinion: Layout should be handled in a single system or set of systems that runs after the communication has concluded. This separates concerns nicely and we don't care about computing or accessing layout for intermediate results. |
Beta Was this translation helpful? Give feedback.
-
Our UI widgets will need to communicate with each other in some way. My understanding is that we have two broad approaches here:
Assuming we move forward with message passing, there are three conceivable strategies for what these "messages" could be represented as:
Message Representation
Messages are expected to be one-to-many, to allow them to affect multiple entities with a single message produced. Messages must scoped in some way, possibly with entity groups (#1592).
Independently, we need to solve the problem of when do our widgets send and receive these messages. This is particularly important in contexts where we have complex trees of behavior, or loops.
Consider a control panel and an output. The text on the control buttons changes based on the current output (e.g. "turn off" / "turn on"), and the output changes based on the button configuration. Depending on the ordering of our systems and the number of times they run per frame, we could end up with either serious delays in processing these results, or rendering a messy and incorrect intermediate state before flashing to a new one.
Widget System Scheduling
Beta Was this translation helpful? Give feedback.
All reactions