fix(spinner): fix animation not ticking sometimes

Andrey Nering created

Change summary

internal/tui/components/chat/messages/messages.go | 5 +----
internal/tui/components/chat/messages/tool.go     | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)

Detailed changes

internal/tui/components/chat/messages/messages.go 🔗

@@ -66,10 +66,7 @@ func NewMessageCmp(msg message.Message) MessageCmp {
 // Returns a command to start the animation for spinning messages.
 func (m *messageCmp) Init() tea.Cmd {
 	m.spinning = m.shouldSpin()
-	if m.spinning {
-		return m.anim.Init()
-	}
-	return nil
+	return m.anim.Init()
 }
 
 // Update handles incoming messages and updates the component state.

internal/tui/components/chat/messages/tool.go 🔗

@@ -114,10 +114,7 @@ func NewToolCallCmp(parentMessageID string, tc message.ToolCall, opts ...ToolCal
 // Returns a command to start the animation for pending tool calls.
 func (m *toolCallCmp) Init() tea.Cmd {
 	m.spinning = m.shouldSpin()
-	if m.spinning {
-		return m.anim.Init()
-	}
-	return nil
+	return m.anim.Init()
 }
 
 // Update handles incoming messages and updates the component state.