diff --git a/internal/ui/app.go b/internal/ui/app.go index e3c35f0..cb59350 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -184,15 +184,18 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg.String() { case "esc", "enter": m.setError(nil) - m.autoRefreshPaused = false - - cmd := m.scheduleAutoRefresh() if len(m.navigation) > 0 { - return m, tea.Batch(m.navigateBack(), cmd) + m.autoRefreshPaused = false + return m, tea.Batch(m.navigateBack(), m.scheduleAutoRefresh()) + } + + if m.loaded { + m.autoRefreshPaused = false + return m, m.scheduleAutoRefresh() } - return m, cmd + return m, nil case "ctrl+x": return m, tea.Quit @@ -218,10 +221,6 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil } - m.autoRefreshPaused = true - m.autoRefreshGeneration++ - m.autoRefreshScheduled = false - m.loading = false m.showLoading = false m.loadingLabel = "" @@ -232,10 +231,6 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil case resource.ErrorMsg: - m.autoRefreshPaused = true - m.autoRefreshGeneration++ - m.autoRefreshScheduled = false - m.loading = false m.showLoading = false m.loadingLabel = "" diff --git a/internal/ui/helpers.go b/internal/ui/helpers.go index f591aea..d9622ec 100644 --- a/internal/ui/helpers.go +++ b/internal/ui/helpers.go @@ -132,6 +132,10 @@ func (m *Model) setError(err error) { return } + m.autoRefreshPaused = true + m.autoRefreshGeneration++ + m.autoRefreshScheduled = false + m.resizeErrorViewport() }