diff --git a/web/src/client/components/file-browser.ts b/web/src/client/components/file-browser.ts index 76b63e1b..939aaafa 100644 --- a/web/src/client/components/file-browser.ts +++ b/web/src/client/components/file-browser.ts @@ -129,11 +129,15 @@ export class FileBrowser extends LitElement { async updated(changedProperties: Map) { super.updated(changedProperties); - if (changedProperties.has('visible') || changedProperties.has('session')) { - if (this.visible) { - this.currentPath = this.session?.workingDir || '.'; - await this.loadDirectory(this.currentPath); - } + // Only load directory when the component becomes visible or when session changes while visible + if (changedProperties.has('visible') && this.visible) { + // Component just became visible + this.currentPath = this.session?.workingDir || '.'; + await this.loadDirectory(this.currentPath); + } else if (changedProperties.has('session') && this.visible) { + // Session changed while component is visible + this.currentPath = this.session?.workingDir || '.'; + await this.loadDirectory(this.currentPath); } // Monaco editor will handle its own updates through properties diff --git a/web/src/server/routes/filesystem.ts b/web/src/server/routes/filesystem.ts index ad3c129a..22dd6dc4 100644 --- a/web/src/server/routes/filesystem.ts +++ b/web/src/server/routes/filesystem.ts @@ -288,10 +288,8 @@ export function createFilesystemRoutes(): Router { return a.name.localeCompare(b.name); }); - logger.log( - chalk.green( - `directory browsed successfully: ${requestedPath} (${filteredFiles.length} items)` - ) + logger.debug( + `directory browsed successfully: ${requestedPath} (${filteredFiles.length} items)` ); res.json({