fix(terminal): key project action state by one canonical directory

The terminal store keyed its directories by trimming trailing slashes,
while the new sidebar activity indicator and the whole-server session
grouping keyed the same folder with the project-action normalizer, which
also rewrites backslashes. On Windows that split one project into two
namespaces: the sidebar reconciled server sessions under "C:/repo" while
the terminal panel and the project actions button worked under "C:\repo",
so the running-action indicator never lit up, adopted tabs were duplicated
and a stop recorded in one namespace did not guard reconciliation in the
other. The project actions button also read the store map directly with a
path normalized somewhere else, missing its own directory entry.

All terminal directory keys now come from normalizeTerminalDirectory in
lib/pathNormalization, and store reads go through getDirectoryState.
This commit is contained in:
Bohdan Triapitsyn
2026-09-05 14:48:25 +03:00
parent 74b8c77d49
commit 03e14b61cd
10 changed files with 62 additions and 26 deletions
@@ -62,7 +62,7 @@ export const TerminalView: React.FC<TerminalViewProps> = ({ visible, directory }
const targetDirectory = directory ?? null;
const terminalDirectory = targetDirectory || contextDirectory;
const hasExplicitTerminalTarget = targetDirectory !== null;
const directoryTerminalState = useTerminalStore((s) => terminalDirectory ? s.sessions.get(terminalDirectory) : undefined);
const directoryTerminalState = useTerminalStore((s) => terminalDirectory ? s.getDirectoryState(terminalDirectory) : undefined);
const terminalHydrated = useTerminalStore((s) => s.hasHydrated);
const ensureDirectory = useTerminalStore((s) => s.ensureDirectory);
const createTab = useTerminalStore((s) => s.createTab);