From f220ac1edcab00bf864e95193d3fcd6e4361359e Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Fri, 2 Oct 2026 00:34:58 +0200 Subject: [PATCH] added loadID check to completion command #82 --- internal/resource/commands.go | 4 +++- internal/ui/app.go | 8 ++++++-- internal/ui/commands.go | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/internal/resource/commands.go b/internal/resource/commands.go index 9d90c1b..d8794f2 100644 --- a/internal/resource/commands.go +++ b/internal/resource/commands.go @@ -32,4 +32,6 @@ type ErrorMsg struct { Err error } -type CommandCompletedMsg struct{} +type CommandCompletedMsg struct { + LoadID uint64 +} diff --git a/internal/ui/app.go b/internal/ui/app.go index b8e3880..81b42fa 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -554,8 +554,12 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil case resource.CommandCompletedMsg: - //m.showLoading = false - //m.loadingLabel = "" + if msg.LoadID != m.loadID { + return m, nil + } + + m.showLoading = false + m.loadingLabel = "" return m, nil } diff --git a/internal/ui/commands.go b/internal/ui/commands.go index 6ed5e76..1016312 100644 --- a/internal/ui/commands.go +++ b/internal/ui/commands.go @@ -116,6 +116,7 @@ func (m *Model) executeResourceCommand(key string) tea.Cmd { m.loadingLabel = "Connecting to " + row.ID } + loadID := m.loadID cmd := m.resource.Execute(command, row) return tea.Batch( @@ -123,7 +124,9 @@ func (m *Model) executeResourceCommand(key string) tea.Cmd { tea.Sequence( cmd, func() tea.Msg { - return resource.CommandCompletedMsg{} + return resource.CommandCompletedMsg{ + LoadID: loadID, + } }, ), )