fix: prevent duplicate card rendering during streaming
Streaming orphan UI cards section was rendering all cards with message_id=NONE as orphans, even when they were already claimed by the message-level orphan matching logic via card_id. Added card_id+tool_call_id check to prevent double rendering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
bfcf22d4f8
commit
2422ea39c6
+13
-2
@@ -1041,10 +1041,21 @@ function App() {
|
||||
{thread.isLoading &&
|
||||
deduplicateUiItems(
|
||||
(thread.values?.ui ?? []).filter((ui: UIMsgLocal) => {
|
||||
const attachedToExisting = activeMessages.some(
|
||||
// Check if attached by message_id
|
||||
const attachedByMsgId = activeMessages.some(
|
||||
(m) => m.id === ui.metadata?.message_id,
|
||||
);
|
||||
return !attachedToExisting;
|
||||
if (attachedByMsgId) return false;
|
||||
// Check if attached by card_id matching any tool_call_id (orphan logic)
|
||||
const cardId = ui.props?.card_id as string | undefined;
|
||||
if (cardId) {
|
||||
const claimedByToolCall = activeMessages.some((m) => {
|
||||
const tcs: { id?: string }[] = (m as any).tool_calls ?? [];
|
||||
return tcs.some((tc) => tc.id && cardId.includes(tc.id));
|
||||
});
|
||||
if (claimedByToolCall) return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
)
|
||||
.map((ui: UIMsgLocal) => (
|
||||
|
||||
Reference in New Issue
Block a user