fix: chat loses conversation context between messages
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 43s

Remove revalidatePath('/chat') from createConversation — it caused
the server to re-render the /chat page after each new conversation,
which reset the useChat hook state and created a new conversation
for every message instead of continuing the existing one.

Sidebar now refreshes client-side after streaming completes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-28 21:54:21 +02:00
parent 4f3ed18d7c
commit 0bccc41ccc
2 changed files with 4 additions and 4 deletions

View File

@@ -60,12 +60,14 @@ export function ChatContainer({ initialConversations, notebooks, webSearchAvaila
}, [isLoading, t])
// Sync historyMessages after each completed streaming response
// so the display doesn't revert to stale history
// so the display doesn't revert to stale history.
// Also refresh sidebar so new conversation appears.
useEffect(() => {
if (status === 'ready' && messages.length > 0) {
setHistoryMessages([...messages])
refreshConversations()
}
}, [status, messages])
}, [status, messages, refreshConversations])
// Load conversation details when the user selects a different conversation
useEffect(() => {