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
```
This commit is contained in:
Billy Irwin 2025-07-02 16:17:01 -07:00 committed by Peter Steinberger
parent 770951c63a
commit b74de48ddd
2 changed files with 11 additions and 9 deletions

View file

@ -129,11 +129,15 @@ export class FileBrowser extends LitElement {
async updated(changedProperties: Map<string, unknown>) {
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

View file

@ -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({