fix(workbench): Reset project state when a window switches projects

Opening another project in the same window left the previous project's state in
module-level stores: Amend and the commit message carried over, debug sessions kept
running, and Git Log, usages, hierarchy, inspection, HTTP client, recent locations,
navigation history and notifications still showed the old project.

Reset each of them on a project root change, stop the old debug sessions, ask about
unsaved changes before leaving a project, close the settings window (it would apply
to the new project) and end the indexing task when a scan is cancelled.
Цей коміт міститься в:
l0ng-ai committed 2026-10-22 20:26:04 +08:00
1 джерело 9a2025b76e
коміт 5f6e2a9c85
30 files changed
+216 -26

No files matched your search

+14
Переглянути файл
@@ -109,6 +109,20 @@ export function installPreparedMessage(): () => void {
const op = (s = useVcs.getState()) => s.branch?.operation ?? null;
if (PREPARED_MESSAGE_OPS.has(op() ?? "")) void load();
return useVcs.subscribe((s, prev) => {
if (s.root !== prev.root) {
// Another repository: nothing typed or ticked for the previous one carries over (Amend least of all).
useCommit.setState({
message: "",
amend: false,
checks: new Map(),
selection: [],
tab: "changes",
selectedList: null,
selectedShelf: null,
});
if (PREPARED_MESSAGE_OPS.has(op(s) ?? "")) void load();
return;
}
const now = op(s);
if (now !== op(prev) && PREPARED_MESSAGE_OPS.has(now ?? "")) void load();
});