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:
@@ -5,6 +5,7 @@ import { z } from 'zod';
|
||||
|
||||
import { getSafeSessionStorage } from '@/stores/utils/safeStorage';
|
||||
import type { TerminalServerSession } from '@/lib/api/types';
|
||||
import { normalizeTerminalDirectory } from '@/lib/pathNormalization';
|
||||
|
||||
export interface TerminalChunk {
|
||||
id: number;
|
||||
@@ -228,13 +229,7 @@ const tabIdNumber = (tabId: string): number | null => {
|
||||
return Number.isFinite(num) ? num : null;
|
||||
};
|
||||
|
||||
function normalizeDirectory(dir: string): string {
|
||||
let normalized = dir.trim();
|
||||
while (normalized.length > 1 && normalized.endsWith('/')) {
|
||||
normalized = normalized.slice(0, -1);
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
const normalizeDirectory = normalizeTerminalDirectory;
|
||||
|
||||
const actionMutationRevisionKey = (directory: string, actionId: string): string => `${directory}\u0000${actionId}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user