Currently, when a user clicks a channel or a guild, the following happens:
The guild button emits the click event to the "controller".
The "controller" is the sidebar, so the sidebar updates its state, then passes the event up to its "controller".
The "controller" is now the main window view, so it updates its state.
This is really bad, because when the window view needs to synchronize its child widgets, there's a risk that the child widget functions might cause it to propagate back up to the window view, causing an infinite recursion.
The better design would be to only propagate up to the main window directly, which is then in charge of updating everything at once. With that, this should happen:
The guild button emits the click event to the "controller".
The "controller" is the main window view, so it updates its state.
The main window view ensures that the sidebar and guild button are consistent.
This way, child widgets never have to worry about propagating back to its parents. Rather, it only has to worry about propagating to its children. User interaction is the only way that child widgets are permitted to propagate up. This will avoid any potential recursion issues.
Currently, when a user clicks a channel or a guild, the following happens:
This is really bad, because when the window view needs to synchronize its child widgets, there's a risk that the child widget functions might cause it to propagate back up to the window view, causing an infinite recursion.
The better design would be to only propagate up to the main window directly, which is then in charge of updating everything at once. With that, this should happen:
This way, child widgets never have to worry about propagating back to its parents. Rather, it only has to worry about propagating to its children. User interaction is the only way that child widgets are permitted to propagate up. This will avoid any potential recursion issues.