on main help sign in
fix: render pills box reliably when todos or queue appear mid-session
1350167Kieran Klukas
internal/ui/model/ui.go+19
@@ -714,11 +714,23 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
714 }
714 }
715 if m.session != nil && msg.Payload.ID == m.session.ID {
715 if m.session != nil && msg.Payload.ID == m.session.ID {
716 prevHasInProgress := hasInProgressTodo(m.session.Todos)
716 prevHasInProgress := hasInProgressTodo(m.session.Todos)
717+ prevPillsHeight := m.pillsAreaHeight()
717 m.session = &msg.Payload
718 m.session = &msg.Payload
718 if !prevHasInProgress && hasInProgressTodo(m.session.Todos) {
719 if !prevHasInProgress && hasInProgressTodo(m.session.Todos) {
719 m.todoIsSpinning = true
720 m.todoIsSpinning = true
720 cmds = append(cmds, m.todoSpinner.Tick)
721 cmds = append(cmds, m.todoSpinner.Tick)
722+ }
723+ // The pills panel reserves vertical space that the chat area
724+ // must yield. Recompute the layout whenever that footprint
725+ // changes (todos appearing, the list growing, etc.) so the
726+ // box renders on first paint rather than waiting for a toggle.
727+ // When the footprint is unchanged we still re-render the pill
728+ // content so status changes (e.g. the in-progress spinner)
729+ // show up.
730+ if m.pillsAreaHeight() != prevPillsHeight {
721 m.updateLayoutAndSize()
731 m.updateLayoutAndSize()
732+ } else {
733+ m.renderPills()
722 }
734 }
723 m.autoExpandPillsIfReasonable()
735 m.autoExpandPillsIfReasonable()
724 }
736 }
@@ -2377,6 +2389,13 @@ func (m *UI) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor {
2377 if m.layout != layout {
2389 if m.layout != layout {
2378 m.layout = layout
2390 m.layout = layout
2379 m.updateSize()
2391 m.updateSize()
2392+ } else if m.state == uiChat && m.hasSession() {
2393+ // Re-render pills on every draw so the box appears even when
2394+ // the layout footprint hasn't changed (e.g. todos arrived
2395+ // while the panel was collapsed). updateSize already calls
2396+ // renderPills, but only when the layout actually differs;
2397+ // this catches the steady-state case.
2398+ m.renderPills()
2380 }
2399 }
2381
2400
2382 // Clear the screen first
2401 // Clear the screen first