Skip to content

Commit 4cd935f

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 8c5a8ae commit 4cd935f

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77

88
## Unreleased
99

10+
### Changed
11+
12+
- Filter the Shared Workspaces view with the server-side `shared_with_user`
13+
query instead of filtering `shared:true` results on the client, so fewer
14+
workspaces are fetched and the view loads faster. Deployments too old to
15+
support the new filter now show a message explaining why instead of an
16+
empty list.
17+
1018
### Fixed
1119

1220
- Apply a 60-second default timeout to REST requests, so requests hung on a

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
@@ -185,17 +185,16 @@ async function doActivate(
185185
output,
186186
deploymentManager.session,
187187
{
188-
// Deployments older than 2.27.0 reject the shared workspaces query;
189-
// hide the view for them (see `when` in package.json).
188+
// Older deployments reject this query; show a message instead of an
189+
// empty tree (see `viewsWelcome` in package.json).
190190
onQueryRejected: () =>
191191
contextManager.set("coder.sharedWorkspacesSupported", false),
192192
},
193193
);
194194
ctx.subscriptions.push(sharedWorkspacesProvider);
195195

196-
// Re-probe shared workspaces support whenever the session changes (login,
197-
// logout, deployment switch): the view re-appears and the next fetch hides
198-
// it again if the deployment still does not support the query.
196+
// Re-probe support on session change (login, logout, deployment switch);
197+
// the next fetch clears the message again if still unsupported.
199198
ctx.subscriptions.push(
200199
deploymentManager.session.onDidChange(() =>
201200
contextManager.set("coder.sharedWorkspacesSupported", true),
@@ -334,8 +333,8 @@ async function doActivate(
334333
commands.navigateToWorkspaceSettings.bind(commands),
335334
);
336335
commandManager.register("coder.refreshWorkspaces", () => {
337-
// Re-probe shared workspaces support in case the deployment was upgraded;
338-
// showing the view triggers its fetch, which hides it again on rejection.
336+
// Re-probe in case the deployment was upgraded; the fetch below clears
337+
// the message again on rejection.
339338
contextManager.set("coder.sharedWorkspacesSupported", true);
340339
void myWorkspacesProvider.fetchAndRefresh();
341340
void sharedWorkspacesProvider.fetchAndRefresh();

0 commit comments

Comments
 (0)