fix: reset _messagesTruncated flag on new session creation

newSession() did not reset _messagesTruncated or _oldestIdx, unlike
loadSession() which resets both at line 590. When a user switched from
a long session (messages > _INITIAL_MSG_LIMIT) to a new session, the
stale _messagesTruncated=true caused renderMessages() to show the
'Scroll up or click to load older messages' indicator on a fresh
conversation with only 1 message.

Add the same reset that loadSession() already performs so newSession()
starts with clean pagination state.
This commit is contained in:
Frank Song committed 2026-05-28 12:13:30 +08:00
1 parent 5528e2c579
commit 9ddf36f510
1 file changed
+2
+2
View File
@@ -455,6 +455,8 @@ async function newSession(flash, options={}){
_newSessionInFlight=(async()=>{
updateQueueBadge();
S.toolCalls=[];
_messagesTruncated=false;
_oldestIdx=0;
clearLiveToolCards();
// One-shot profile-switch workspace: applied to the first new session after a profile
// switch, then cleared. Use a dedicated flag so S._profileDefaultWorkspace (the