The Bubble Tea Update contract returns a tea.Model interface, which forces us to type-assert the result back to the concrete sub-model type before reassigning it. The helpers below centralise that boilerplate. Two flavours are provided: - updateXCmd: forwards a message to a sub-model and returns t
(msg tea.Msg)
| 26 | |
| 27 | // updateChatCmd forwards a message to the chat page and returns its cmd. |
| 28 | func (m *appModel) updateChatCmd(msg tea.Msg) tea.Cmd { |
| 29 | updated, cmd := m.chatPage.Update(msg) |
| 30 | m.chatPage = updated.(chat.Page) |
| 31 | return cmd |
| 32 | } |
| 33 | |
| 34 | // updateEditorCmd forwards a message to the editor and returns its cmd. |
| 35 | func (m *appModel) updateEditorCmd(msg tea.Msg) tea.Cmd { |
no test coverage detected