Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 群聊回执晚于时间线到达时立即结算发件箱条目

Dash3527d1859bea
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
index 648bf51e61..69e69a1eaa 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx
@@ -353,13 +353,14 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {
() => (state.kind === 'ready' ? projectBotGroupExecutionFailures(mergeBotGroupMessages(state.older, state.group.messages), state.group.executionFailures) : []),
[state],
);
+ const outbox = useBotGroupOutbox(groupId);
// Settle receipts only once the read that shows them is on screen, so a pending bubble
// never disappears a frame before its real message appears. Older pages count too: a
// message pushed off the latest page settles its previews once 查看更早的消息 shows it.
+ // A receipt for a message the timeline already shows settles when it comes back.
useLayoutEffect(() => {
if (state.kind === 'ready') noteBotGroupTimeline(groupId, mergeBotGroupMessages(state.older, state.group.messages), state.readToken);
- }, [groupId, state]);
- const outbox = useBotGroupOutbox(groupId);
+ }, [groupId, state, outbox]);
const { pending: pendingSends, localAttachments } = useMemo(
() => projectBotGroupOutbox(outbox, messages, getBotGroupOutboxClaims(groupId), getBotGroupOutboxPreviews(groupId)),
[groupId, messages, outbox],
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
index d85e49a032..6e105fc4fa 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx
@@ -1242,7 +1242,9 @@ describe('BotGroupChatView', () => {
await waitFor(() => expect(outboxItems()).toHaveLength(0));
expect(screen.getAllByText('早到的推送')).toHaveLength(1);
+ // The receipt settles against the timeline already on screen, with no further push.
await send.resolve({ ok: true, messageId: 'u2' });
+ await waitFor(() => expect(getBotGroupOutbox('g1')).toHaveLength(0));
pushMessages();
await waitFor(() => expect(mocks.getBotGroup).toHaveBeenCalledTimes(3));
expect(screen.getAllByText('早到的推送')).toHaveLength(1);