bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Active collection environment is not cleared when its file is deleted

Open tuanxminhxgi opened this issue 4 weeks ago • 1 comments

Description

When the active collection environment's file is deleted from disk (e.g. removed outside Bruno, or via git checkout of a branch without it), the environment disappears from the list, but collection.activeEnvironmentUid in the Redux store keeps pointing at the uid of the deleted environment.

Steps to reproduce

  1. Open a collection with an environment, e.g. environments/dev.yml, and select it as the active environment.
  2. Delete environments/dev.yml from disk outside Bruno.
  3. The environment is removed from the environment list, but activeEnvironmentUid still holds the old uid.
  4. Recreate a file at the same path: it silently becomes the active environment again, because environment uids are derived from the file path.

Expected

Removing the active environment's file should reset the selection to "No Environment", the same way deleting the active global environment already does (_deleteGlobalEnvironment).

Notes

This is also called out by an existing TODO in collectionUnlinkEnvFileEvent (packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js).

tuanxminhxgi avatar Nov 05 '26 08:11 tuanxminhxgi

Thanks for the clear report @tuanxminhxgi. I was able to reproduce it: after the selected environment’s file is removed, it disappears from the list, but requests keep using its values.

Your fix in PR #9766 resolves this in my testing. Follow that PR for updates.

aditya-bruno avatar Nov 06 '26 10:11 aditya-bruno