Skip to content

Commit 408bdda

Browse files
committed
fix: show a message instead of hiding the shared workspaces view
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.
1 parent 86cebd1 commit 408bdda

3 files changed

Lines changed: 25 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
bar item instead). A new **Coder: View Announcements** command opens the full
1616
messages in a markdown preview.
1717

18+
### Changed
19+
20+
- Filter the Shared Workspaces view with the server-side `shared_with_user`
21+
query instead of filtering `shared:true` results on the client, so fewer
22+
workspaces are fetched and the view loads faster. Deployments too old to
23+
support the new filter now show a message explaining why instead of an
24+
empty list.
25+
1826
### Fixed
1927

2028
- Apply a 60-second default timeout to REST requests, so requests hung on a
@@ -60,8 +68,6 @@
6068
`coder logout` rather than by the extension directly. The minimum supported
6169
Coder version is now v0.25.0.
6270

63-
### Changed
64-
6571
- Workspace opens and `coder://` URI handling now log more diagnostics (target
6672
workspace, agent, and handoff) to make failed opens easier to trace. URI
6773
parameter values, including tokens, are never logged.

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
"visibility": "visible",
326326
"icon": "media/logo-white.svg",
327327
"initialSize": 1,
328-
"when": "coder.authenticated && coder.sharedWorkspacesSupported"
328+
"when": "coder.authenticated"
329329
},
330330
{
331331
"id": "allWorkspaces",
@@ -371,6 +371,16 @@
371371
"view": "coder.tasksLogin",
372372
"contents": "Sign in to view and manage Coder tasks.\n[Login](command:coder.login)",
373373
"when": "!coder.authenticated && coder.loaded"
374+
},
375+
{
376+
"view": "sharedWorkspaces",
377+
"contents": "Shared workspaces require Coder 2.27.0 or newer.",
378+
"when": "coder.authenticated && !coder.sharedWorkspacesSupported"
379+
},
380+
{
381+
"view": "sharedWorkspaces",
382+
"contents": "No workspaces have been shared with you.",
383+
"when": "coder.authenticated && coder.sharedWorkspacesSupported"
374384
}
375385
],
376386
"commands": [

src/extension.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,16 @@ async function doActivate(
194194
output,
195195
deploymentManager.session,
196196
{
197-
// Deployments older than 2.27.0 reject the shared workspaces query;
198-
// hide the view for them (see `when` in package.json).
197+
// Older deployments reject this query; show a message instead of an
198+
// empty tree (see `viewsWelcome` in package.json).
199199
onQueryRejected: () =>
200200
contextManager.set("coder.sharedWorkspacesSupported", false),
201201
},
202202
);
203203
ctx.subscriptions.push(sharedWorkspacesProvider);
204204

205-
// Re-probe shared workspaces support whenever the session changes (login,
206-
// logout, deployment switch): the view re-appears and the next fetch hides
207-
// it again if the deployment still does not support the query.
205+
// Re-probe support on session change (login, logout, deployment switch);
206+
// the next fetch clears the message again if still unsupported.
208207
ctx.subscriptions.push(
209208
deploymentManager.session.onDidChange(() =>
210209
contextManager.set("coder.sharedWorkspacesSupported", true),
@@ -343,8 +342,8 @@ async function doActivate(
343342
commands.navigateToWorkspaceSettings.bind(commands),
344343
);
345344
commandManager.register("coder.refreshWorkspaces", () => {
346-
// Re-probe shared workspaces support in case the deployment was upgraded;
347-
// showing the view triggers its fetch, which hides it again on rejection.
345+
// Re-probe in case the deployment was upgraded; the fetch below clears
346+
// the message again on rejection.
348347
contextManager.set("coder.sharedWorkspacesSupported", true);
349348
void myWorkspacesProvider.fetchAndRefresh();
350349
void sharedWorkspacesProvider.fetchAndRefresh();

0 commit comments

Comments
 (0)