This commit is contained in:
Timothy Jaeryang Baek 2026-11-04 15:13:35 +09:00
parent 7cd0f14110
commit 500ff30bb7

View file

@ -59,6 +59,8 @@
// Directory and preview state belong to this tab, including its terminal connection.
let savedPath = '/';
// savedPath is only a placeholder until a directory has loaded.
let savedPathLoaded = false;
let savedFileRoot: TerminalFileRoot | null = null;
const treeExpandedCache = new Map<string, string[]>();
const treeContentsCache = new Map<string, [string, FileEntry[]][]>();
@ -706,7 +708,7 @@
}
// Chat just got created (null → real ID): persist the current
// browsed path as the new session's cwd — don't re-fetch.
setCwd(terminal.url, terminal.key, savedPath, chatId);
if (savedPathLoaded) setCwd(terminal.url, terminal.key, savedPath, chatId);
} else if (terminalChanged || chatChanged) {
++loadGeneration;
openedFile = null;
@ -1032,6 +1034,7 @@
}
currentPath = directory;
savedPath = directory;
savedPathLoaded = true;
pushNavHistory(directory);
const result = await listFiles(terminal.url, terminal.key, directory, chatId ?? undefined);