Replies: 2 comments
-
So technically speaking the "canonical" solve for this would be to add some logic in your top level update to route messages to the correct children, and altering them if necessary along the way as data in The Elm Architecture naturally flows down. We should probably make |
Beta Was this translation helpful? Give feedback.
-
I opened a draft PR (#936) with one possible solution. It's pretty minimal; just enough to allow me to ensure I can route a message to the subcomponent that returned any given Yes, if Please note that my particular solution—a single |
Beta Was this translation helpful? Give feedback.
-
I have an applicaton that displays multiple models at once. What I want to do is deliver the message to the same model that sent the message.
One suggestion mentioned here #649 is that you just propagate the message to all models, and the model should be in charge of handling messages it owns.
However this isn't a pattern used everywhere. For example the list in bubbles responds to all messages for lists https://github.com/charmbracelet/bubbles/blob/master/list/list.go#L757
What I'd like to be able to do is intercept model commands and annotate their messages with the return route. That way, when messages come back I could route them to the right destination.
Or, ideally it would be possible to implement some event loop interceptor at each routing layer to isolate independent parts of the program; run commands, deliver their messages to the target model and propagate an update for re-draw back to the main tea program.
Having bubbletea provide abstractions to do this would be nice, but its something I could write myself by re-implementing the behaviour of the program event loop.
However I can't implement either approach because
sequenceMsg
is private:bubbletea/commands.go
Line 44 in c267762
So it's impossible to unroll and intercept inner messages, unlike BatchMsg which is public.
Beta Was this translation helpful? Give feedback.
All reactions