feat: use shared_with_user filter for the shared workspaces view#1026
Open
EhabY wants to merge 3 commits into
Open
feat: use shared_with_user filter for the shared workspaces view#1026EhabY wants to merge 3 commits into
EhabY wants to merge 3 commits into
Conversation
code-asher
reviewed
Jul 7, 2026
378bb06 to
8c5a8ae
Compare
4cd935f to
408bdda
Compare
Toggling view visibility based on coder.sharedWorkspacesSupported raced the manual refresh command's context flip, causing the view to flicker on and off across refreshes. The view is now always shown when authenticated, with viewsWelcome explaining when shared workspaces aren't supported or the list is empty.
408bdda to
6667b81
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shared_with_user:<current user id>instead of fetchingshared:trueand filtering out own workspaces client-side. The server-side filter returns exactly the workspaces shared with the user, soexcludeOwn/filterWorkspaces()are removed.coder.sharedWorkspacesSupportedcontext key instead of showing an empty tree. The flag resets on any session change (login/logout/deployment switch) and oncoder.refreshWorkspaces, so the view re-probes without restarting VS Code.initialSizeweights to the sidebar views: My Workspaces2, Shared1, All1(50/25/25 when all are visible). Only affects fresh installs / reset layouts.Compatibility
shared_with_user:shipped in the same server release asshared:true(both merged Sept 2025, first released in v2.27.0 — coder/coder#19807 and coder/coder#19875), so there is no deployment where the old query works and the new one doesn't.shared_with_user:mewas intentionally avoided since "me" support only landed in coder/coder#26494 (v2.35+); the user UUID works on every supported version and is immune to renames.On pre-2.27 deployments the previous behavior was a logged fetch error and a permanently empty Shared view; it is now hidden entirely.
Implementation plan / decision log
workspacesProvider.tsWorkspaceQueryenum values become plain identifiers (mine/all/shared); the actual search query moves intoWORKSPACE_QUERY_CONFIGasgetQuery(session), built at fetch time because the Shared query needs the signed-in user's ID.parseUseron the server accepts both, but the UUID avoids rename/quoting issues.onQueryRejectedoption, invoked only for axios HTTP 400 responses. Network errors/5xx keep the existing behavior (warning log + empty tree) so transient failures never hide the view.extension.ts/contextManager.tscoder.sharedWorkspacesSupported, defaulttrue.falseononQueryRejected.trueondeploymentManager.session.onDidChangeand in thecoder.refreshWorkspacescommand (covers in-place server upgrades: re-showing the view triggers its fetch, which hides it again if still unsupported). Hiding the view also stops its polling, since visibility drives the fetch loop.package.jsonsharedWorkspacesview gated oncoder.authenticated && coder.sharedWorkspacesSupported(same pattern ascoder.isOwneronallWorkspaces).initialSizeis a stable views-contribution property honored when the extension owns the view container (it does).onQueryRejectedcoverage (400 fires it once, non-400 does not).Testing
pnpm typecheck,pnpm lint,pnpm format:checkpnpm test— 143 files, 2149 passed / 1 skipped