Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/resource/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ type ErrorMsg struct {
Err error
}

type CommandCompletedMsg struct{}
type CommandCompletedMsg struct {
LoadID uint64
}
8 changes: 6 additions & 2 deletions internal/ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
Expand Down
5 changes: 4 additions & 1 deletion internal/ui/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@ 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(
m.spinner.Tick,
tea.Sequence(
cmd,
func() tea.Msg {
return resource.CommandCompletedMsg{}
return resource.CommandCompletedMsg{
LoadID: loadID,
}
},
),
)
Expand Down
Loading