Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(channel): say typing only while the direct Channel replies, and restore the composer line (#22886)

Arvin Xu0b218e1a986e
diff --git a/src/features/Channels/styles.ts b/src/features/Channels/styles.ts
index f0c3fd86a43..cce117775d8 100644
--- a/src/features/Channels/styles.ts
+++ b/src/features/Channels/styles.ts
@@ -245,10 +245,9 @@ export const styles = stylex.create({
flex: '1',
minWidth: 0,
maxHeight: 240,
- // Buttons sit on the last line; the glyphs ride about 1.5px high in the line box,
- // so drop the text that much to center it on the 28px icons beside it. Layout snaps
- // text to whole pixels, so only a transform can move it the half pixel.
- transform: 'translateY(1.5px)',
+ // Buttons sit on the last line; glyphs ride high in the line box, so drop the
+ // text 1px to center it on the 28px icons beside it.
+ marginBlockEnd: -1,
},
/** Takes the composer's place while the channel or thread is archived. */
archivedNotice: {
diff --git a/src/features/MessageList/AgentConversation.test.tsx b/src/features/MessageList/AgentConversation.test.tsx
index 34cf2a75272..b42ae9385d1 100644
--- a/src/features/MessageList/AgentConversation.test.tsx
+++ b/src/features/MessageList/AgentConversation.test.tsx
@@ -49,7 +49,8 @@ vi.mock('@/features/HomeSidebar/Body/Agent/ModalProvider', () => ({
useAgentModal: () => ({ openCreateGroupModal: () => {} }),
}));
vi.mock('@/hooks/usePrefetchAgent', () => ({ usePrefetchAgent: () => () => {} }));
-vi.mock('@/store/chat', () => ({ useChatStore: () => false }));
+const chat = vi.hoisted(() => ({ running: false }));
+vi.mock('@/store/chat', () => ({ useChatStore: () => chat.running }));
vi.mock('@/store/chat/selectors', () => ({
operationSelectors: { isAgentVisiblyRunning: () => () => false },
}));
@@ -199,4 +200,17 @@ describe('AgentConversation reply activity', () => {
expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-state', 'working');
expect(screen.getByTestId('row')).toHaveAttribute('data-typing', 'true');
});
+
+ // The row said typing while the Channel was idle: the Agent was running in its other topics.
+ it('only animates the avatar while the Agent runs elsewhere', () => {
+ showReply({ status: 'completed' });
+ chat.running = true;
+ render(
+ createElement(AgentConversation, { active: true, conversation: conversation(undefined, {}) }),
+ );
+ chat.running = false;
+
+ expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-state', 'working');
+ expect(screen.getByTestId('row')).toHaveAttribute('data-typing', 'false');
+ });
});
diff --git a/src/features/MessageList/AgentConversation.tsx b/src/features/MessageList/AgentConversation.tsx
index 351e3cf04b8..7694e6dd699 100644
--- a/src/features/MessageList/AgentConversation.tsx
+++ b/src/features/MessageList/AgentConversation.tsx
@@ -34,8 +34,9 @@ const AgentConversation = memo<AgentConversationProps>(({ active, conversation }
const { onClick, url } = useAgentConversationLink(id, agentUrl);
const { channelActions, replyState } = useDirectChannelRow(conversation.channel, active);
const avatarState = replyState ?? (chatRunning ? 'working' : undefined);
- // A blocked reply keeps the preview; its avatar already shows it waiting.
- const typing = !!avatarState && avatarState !== 'waiting';
+ // Only the direct Channel's own reply says typing: a run in one of the Agent's other topics
+ // only animates the avatar. A blocked reply keeps the preview; its avatar shows it waiting.
+ const typing = !!replyState && replyState !== 'waiting';
const title = agentDisplayName(item, t('untitledAgent'));
const avatarSrc = typeof avatar === 'string' ? avatar : undefined;