From 5df60ad6cfc1334c48830d6b4f6fb53ec5bf798c Mon Sep 17 00:00:00 2001 From: Nuwan Date: Fri, 6 Feb 2026 16:04:41 +0530 Subject: [PATCH] fix(15): pass sessionId to fetchChatHistory for session messages The fetchChatHistory thunk needs sessionId to determine channel type: - With sessionId: fetches 'session' channel messages - Without sessionId: fetches 'global' channel messages The useEffect was only passing `channel` (which is the sessionId for session chats), but not the `sessionId` parameter. This caused the API to fetch global chat instead of session chat, so session messages disappeared after page reload. Co-Authored-By: Claude Opus 4.5 --- jam-ui/src/components/client/chat/JKChatMessageList.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jam-ui/src/components/client/chat/JKChatMessageList.js b/jam-ui/src/components/client/chat/JKChatMessageList.js index 98ce9a1c1..7e401968a 100644 --- a/jam-ui/src/components/client/chat/JKChatMessageList.js +++ b/jam-ui/src/components/client/chat/JKChatMessageList.js @@ -131,9 +131,14 @@ const JKChatMessageList = () => { */ useEffect(() => { if (activeChannel && fetchStatus !== 'loading' && fetchStatus !== 'succeeded') { - dispatch(fetchChatHistory({ channel: activeChannel })); + // For session chat, activeChannel is the sessionId + // Pass sessionId so the thunk knows to fetch 'session' channel type + dispatch(fetchChatHistory({ + channel: activeChannel, + sessionId: sessionId || activeChannel // Use sessionId from Redux, fallback to activeChannel + })); } - }, [dispatch, activeChannel, fetchStatus]); + }, [dispatch, activeChannel, sessionId, fetchStatus]); // Loading state if (fetchStatus === 'loading' && messages.length === 0) {