From b74de48ddd743539ccdb18a8743cb77f939be1f0 Mon Sep 17 00:00:00 2001 From: Billy Irwin Date: Wed, 2 Jul 2025 16:17:01 -0700 Subject: [PATCH] ``` fix: prevent file browser flashing and reduce log verbosity - Split visibility and session change handling to avoid redundant directory loads - Only reload directory when component becomes visible or session changes while visible - Change directory browse success log from info to debug level to reduce noise - Fixes issue where file browser would flash/reload unnecessarily on prop changes ``` --- web/src/client/components/file-browser.ts | 14 +++++++++----- web/src/server/routes/filesystem.ts | 6 ++---- 2 files changed, 11 insertions(+), 9 deletions(-) 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({