refactor(ui/chat): migrate onReady to command-based arch

This commit is contained in:
ayn2op 2026-03-19 20:51:36 -04:00
parent 6e3f340b55
commit 926dd8cedd
2 changed files with 3 additions and 3 deletions

View file

@ -254,7 +254,7 @@ func (m *Model) HandleEvent(event tview.Event) tview.Command {
m.onRaw(event)
case *gateway.ReadyEvent:
m.onReady(event)
return tview.Batch(m.onReady(event), m.listen())
case *gateway.MessageCreateEvent:
m.onMessageCreate(event)

View file

@ -29,7 +29,7 @@ func (m *Model) onRaw(event *ws.RawEvent) {
)
}
func (m *Model) onReady(event *gateway.ReadyEvent) {
func (m *Model) onReady(event *gateway.ReadyEvent) tview.Command {
// Rebuild indexes from scratch so reconnects and account switches do not
// retain pointers to detached tree nodes.
m.guildsTree.resetNodeIndex()
@ -92,7 +92,7 @@ func (m *Model) onReady(event *gateway.ReadyEvent) {
}
m.guildsTree.SetCurrentNode(root)
m.app.SetFocus(m.guildsTree)
return tview.SetFocus(m.guildsTree)
}
func (m *Model) onMessageCreate(message *gateway.MessageCreateEvent) {