Skip to content

fix(sidebar): invalidate env cache on workspace change + '+' button opens existing env (#895) - #900

Merged
jeonghun-jj-lee merged 1 commit into
mainfrom
fix/895-env-context-menu-v2
Sep 8, 2026
Merged

fix(sidebar): invalidate env cache on workspace change + '+' button opens existing env (#895)#900
jeonghun-jj-lee merged 1 commit into
mainfrom
fix/895-env-context-menu-v2

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Two fixes for the Research Environments sidebar section (#895):

  1. invalidateEnvironmentCache() in onDidChangeWorkspaceFolders — the root cause of 'Remove from Workspace' never appearing. When the user clicked 'Add to Workspace' on a resolved environment, updateWorkspaceFolders triggered the workspace change handler, which called getRoots(). But the environment resolver cache was stale, so the project resolution in Pass 2 still returned the old resolved path. The dedup logic saw it first (before the workspace pass could register the same slug), so the environment kept source: "resolved". Clearing the cache ensures the workspace-folder path wins the dedup.

  2. '+' button → add-existing-environment — the '+' on the environments section header was sending new-environment (create flow). It should send add-existing-environment (folder picker), matching the Research Projects pattern where '+' adds an existing project.

2 updated tests (more precise assertions).

…pens existing env (#895)

Two fixes:

1. onDidChangeWorkspaceFolders now calls invalidateEnvironmentCache()
   before getRoots(). Without this, adding an environment to the workspace
   via 'Add to Workspace' left the resolver cache stale — getRoots()
   returned the environment with source 'resolved' instead of 'workspace',
   so the context menu kept showing 'Add to Workspace' instead of
   'Remove from Workspace'.

2. The '+' button on the Research Environments section header now sends
   'add-existing-environment' (folder picker) instead of 'new-environment'
   (create flow). The '+' should open an existing environment, matching
   the Research Projects section pattern.
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f5508d67-a91a-430b-a014-7e8dfce01f0b


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeonghun-jj-lee
jeonghun-jj-lee merged commit b53adab into main Sep 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant