Fix project isolation: Make loadChatHistory respect active project sessions
- Modified loadChatHistory() to check for active project before fetching all sessions - When active project exists, use project.sessions instead of fetching from API - Added detailed console logging to debug session filtering - This prevents ALL sessions from appearing in every project's sidebar Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,8 @@ class SessionTabs {
|
||||
// Filter out closed sessions
|
||||
this.sessions = (sessions || []).filter(s => !this.closedSessions.has(s.id));
|
||||
console.log('[SessionTabs] Set', this.sessions.length, 'sessions (filtered out', (sessions || []).length - this.sessions.length, 'closed)');
|
||||
// CRITICAL FIX: Render immediately after setting sessions
|
||||
this.render();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +84,8 @@ class SessionTabs {
|
||||
setActiveSession(sessionId) {
|
||||
this.activeSessionId = sessionId;
|
||||
console.log('[SessionTabs] Active session:', sessionId);
|
||||
// CRITICAL FIX: Render to update active state visually
|
||||
this.render();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,12 +529,17 @@ class SessionTabs {
|
||||
updateSession(session) {
|
||||
const index = this.sessions.findIndex(s => s.id === session.id);
|
||||
if (index !== -1) {
|
||||
// Update existing session
|
||||
this.sessions[index] = session;
|
||||
// Move to top
|
||||
this.sessions.splice(index, 1);
|
||||
this.sessions.unshift(session);
|
||||
this.render();
|
||||
} else {
|
||||
// CRITICAL FIX: Add new session if not found
|
||||
this.sessions.unshift(session);
|
||||
console.log('[SessionTabs] Added new session:', session.id);
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user