Skip to content

Commit 0e7eccd

Browse files
committed
Trigger an immediate refresh of the incident list when turning on
auto-refresh Auto-refresh should immediately poll for new incidents when enabled, rather than awaiting the PollIncidentsMsg. Signed-off-by: Chris Collins <collins.christopher@gmail.com>
1 parent 487b639 commit 0e7eccd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/tui/msgHandlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (m model) keyMsgHandler(msg tea.Msg) (tea.Model, tea.Cmd) {
114114

115115
if key.Matches(msg.(tea.KeyMsg), defaultKeyMap.AutoRefresh) {
116116
m.autoRefresh = !m.autoRefresh
117-
return m, nil
117+
return m, updateIncidentList(m.config)
118118
}
119119

120120
if key.Matches(msg.(tea.KeyMsg), defaultKeyMap.AutoAck) {

pkg/tui/tui.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
117117

118118
case setStatusMsg:
119119
return m.setStatusMsgHandler(msg)
120+
120121
// Command to trigger a regular poll for new incidents
121122
case PollIncidentsMsg:
122123
if !m.autoRefresh {
123124
return m, nil
124125
}
125-
m.setStatus("polling for new incidents...")
126-
return m, func() tea.Msg { return updateIncidentListMsg("sender: PollIncidentsMsg") }
126+
return m, updateIncidentList(m.config)
127127

128128
// Command to get an incident by ID
129129
case getIncidentMsg:

0 commit comments

Comments
 (0)