Skip to content

Commit 444d4ec

Browse files
committed
Fix agent session history loading
1 parent 8c597ce commit 444d4ec

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

frontend/src/pages/Agent.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ export function Agent() {
396396
const { sessionId: curSid, messages: curMsgs, cacheSession, reset, getCachedSession, switchSession } = act();
397397

398398
if (urlSessionId && urlSessionId !== curSid) {
399-
const gen = ++genRef.current;
399+
const gen = genRef.current + 1;
400+
genRef.current = gen;
400401
doDisconnect();
401402
if (curSid && curMsgs.length > 0) cacheSession(curSid, curMsgs);
402403

@@ -410,9 +411,9 @@ export function Agent() {
410411
}
411412
setupSSE(urlSessionId);
412413
} else if (!urlSessionId && curSid) {
413-
++genRef.current;
414+
genRef.current += 1;
414415
doDisconnect();
415-
if (curMsgs.length > 0) cacheSession(curSid, curMsgs);
416+
if (curSid && curMsgs.length > 0) cacheSession(curSid, curMsgs);
416417
reset();
417418
}
418419
}, [urlSessionId, doDisconnect, loadSessionMessages, setupSSE, forceScrollToBottom]);

0 commit comments

Comments
 (0)