From aea4f6934ea9fd7f229641f64ba581ef2c4200b7 Mon Sep 17 00:00:00 2001 From: naman-bruno Date: Wed, 7 Jan 2026 14:35:03 +0530 Subject: [PATCH] fix: workspace already opened (#6721) --- packages/bruno-electron/src/app/workspace-watcher.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/bruno-electron/src/app/workspace-watcher.js b/packages/bruno-electron/src/app/workspace-watcher.js index f57d0841b..f9c3d97cc 100644 --- a/packages/bruno-electron/src/app/workspace-watcher.js +++ b/packages/bruno-electron/src/app/workspace-watcher.js @@ -147,7 +147,7 @@ class WorkspaceWatcher { } const watcher = chokidar.watch(workspaceFilePath, { - ignoreInitial: false, + ignoreInitial: true, persistent: true, ignorePermissionErrors: true, awaitWriteFinish: { @@ -156,8 +156,11 @@ class WorkspaceWatcher { } }); + // Only listen for 'change' events - 'add' event is not needed because: + // 1. The workspace is already loaded when the watcher is started + // 2. ignoreInitial: true prevents firing for existing files + // 3. If workspace.yml is deleted and recreated, 'change' will catch it watcher.on('change', () => handleWorkspaceFileChange(win, workspacePath)); - watcher.on('add', () => handleWorkspaceFileChange(win, workspacePath)); self.watchers[workspacePath] = watcher;