fix(ui): dialogs: ensure returned commands are executed

Ayman Bagabas created

Change summary

internal/ui/dialog/commands.go | 4 +++-
internal/ui/dialog/models.go   | 4 +++-
internal/ui/dialog/sessions.go | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)

Detailed changes

internal/ui/dialog/commands.go 🔗

@@ -176,7 +176,9 @@ func (c *Commands) Update(msg tea.Msg) tea.Msg {
 			c.list.SetFilter(value)
 			c.list.ScrollToTop()
 			c.list.SetSelected(0)
-			return cmd
+			if cmd != nil {
+				return cmd()
+			}
 		}
 	}
 	return nil

internal/ui/dialog/models.go 🔗

@@ -222,7 +222,9 @@ func (m *Models) Update(msg tea.Msg) tea.Msg {
 			value := m.input.Value()
 			m.list.SetFilter(value)
 			m.list.ScrollToSelected()
-			return cmd
+			if cmd != nil {
+				return cmd()
+			}
 		}
 	}
 	return nil

internal/ui/dialog/sessions.go 🔗

@@ -140,7 +140,9 @@ func (s *Session) Update(msg tea.Msg) tea.Msg {
 			s.list.SetFilter(value)
 			s.list.ScrollToTop()
 			s.list.SetSelected(0)
-			return cmd
+			if cmd != nil {
+				return cmd()
+			}
 		}
 	}
 	return nil