fix: Projekt wird beim Session-Klick automatisch mitgewechselt

Wenn eine Session angeklickt wird die zu einem anderen Projekt gehört,
wird jetzt automatisch switch_project aufgerufen (CWD, Context, KB-Filter).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eddy 2026-04-21 15:02:56 +02:00
parent 8725e2f4e6
commit 50c92072f5

View file

@ -208,6 +208,18 @@
activeSessionId = session.id; activeSessionId = session.id;
$currentSessionId = session.id; $currentSessionId = session.id;
clearAll(); clearAll();
// Projekt automatisch mitwechseln wenn Session ein working_dir hat
if (session.working_dir) {
const matchingProject = projects.find(p => p.working_dir === session.working_dir);
if (matchingProject && matchingProject.id !== activeProject?.id) {
// Projekt auf Rust-Seite wechseln (CWD, Context), aber Sessions NICHT neu laden
const project: Project = await invoke('switch_project', { projectId: matchingProject.id });
activeProject = project;
console.log(`📂 Projekt mitwechselt: ${project.name}`);
}
}
// Nachrichten aus DB laden // Nachrichten aus DB laden
await loadSessionMessages(session.id); await loadSessionMessages(session.id);
} catch (err) { } catch (err) {