Skip to content

Commit a01bb75

Browse files
committed
optimize history
1 parent 68d4f84 commit a01bb75

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

client/packages/lowcoder/src/comps/comps/chatComp/components/ChatCoreMain.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ export function ChatCoreMain({
8787
// Get messages for current thread
8888
const currentMessages = actions.getCurrentMessages();
8989

90-
// Notify parent component of conversation changes
90+
// Notify parent component of conversation changes - OPTIMIZED TIMING
9191
useEffect(() => {
92-
onConversationUpdate?.(currentMessages);
93-
}, [currentMessages]);
92+
// Only update conversationHistory when we have complete conversations
93+
// Skip empty states and intermediate processing states
94+
if (currentMessages.length > 0 && !isRunning) {
95+
onConversationUpdate?.(currentMessages);
96+
}
97+
}, [currentMessages, isRunning]);
9498

9599
// Trigger component load event on mount
96100
useEffect(() => {

0 commit comments

Comments
 (0)