Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: during workspace bulk start/stop, skip workspaces already in target state - #27108

Merged
aqandrew merged 3 commits into
mainfrom
aqandrew/devex-308-bulk-start-should-ignore-already-running-workspaces
Jul 9, 2026
Merged

fix: during workspace bulk start/stop, skip workspaces already in target state#27108
aqandrew merged 3 commits into
mainfrom
aqandrew/devex-308-bulk-start-should-ignore-already-running-workspaces

Conversation

@aqandrew

@aqandrew aqandrew commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Previously, bulk start required every selected workspace to be stopped, and bulk stop required every selected workspace to be running. Mixed selections disabled both buttons entirely.

  • Change the disabled checks on bulk start/stop from every() to some() so the buttons are enabled when at least one workspace is eligible.
  • Filter workspaces by status in the mutation functions so only eligible workspaces are sent to the API, matching the pattern used by other batch mutations (update, favorite, unfavorite).
  • Update docs to reflect the new behavior.

Note

Generated by Coder Agents. View session.

Implementation plan

Problem

When an admin selects multiple workspaces and opens the "Bulk actions" dropdown, the Start menu item is disabled unless every selected workspace has latest_build.status === "stopped". If even one workspace is already running (or in any other non-stopped state), the Start button is grayed out and unusable. Same issue applies to Stop.

Changes

1. Relax disabled condition (WorkspacesPageView.tsx)

Changed every() to some() for both Start and Stop dropdown items. The buttons are now enabled when at least one selected workspace is in the target state.

2. Filter in mutations (batchActions.ts)

Added .filter() before .map() in both startAllMutation and stopAllMutation so only eligible workspaces hit the API. This matches the existing pattern in updateAllMutation, favoriteAllMutation, and unfavoriteAllMutation.

3. Update documentation (docs/user-guides/workspace-management.md)

Replaced "can only be applied to a set of workspaces which are all in the same state" with "apply to eligible workspaces in the selection, skipping workspaces that are already in the target state."

Testing

Four new Storybook stories:

Story What it tests
StartIgnoresAlreadyRunningWorkspaces Mixed selection; only stopped workspaces get startWorkspace calls
StopIgnoresAlreadyStoppedWorkspaces Mixed selection; only running workspaces get stopWorkspace calls
StartDisabledWhenNoWorkspacesAreStartable All running; Start button is disabled
StopDisabledWhenNoWorkspacesAreStoppable All stopped; Stop button is disabled

…et state

Previously, bulk start required every selected workspace to be stopped,
and bulk stop required every selected workspace to be running. Mixed
selections disabled both buttons entirely.

Change the disabled checks from every() to some() so the buttons are
enabled when at least one workspace is eligible. Filter workspaces by
status in the mutation functions so only eligible workspaces are sent
to the API, matching the pattern used by other batch mutations
(update, favorite, unfavorite). Add four new Storybook stories to
cover mixed-state selections and disabled-when-none-eligible cases.
Update docs to reflect the new behavior.
@linear-code

linear-code Bot commented Jul 8, 2026

Copy link
Copy Markdown

DEVEX-308

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Docs preview

📖 View docs preview for docs/user-guides/workspace-management.md

@aqandrew aqandrew changed the title fix(site): bulk start and stop should skip workspaces already in target state fix: during workspace bulk start/stop, skip workspaces already in target state Jul 8, 2026
@aqandrew
aqandrew marked this pull request as ready for review July 8, 2026 21:47
@aqandrew
aqandrew requested review from aslilac and ethanndickson July 8, 2026 21:48

@aslilac aslilac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

little things!!!!

@aqandrew
aqandrew merged commit 3e85cfb into main Jul 9, 2026
39 of 40 checks passed
@aqandrew
aqandrew deleted the aqandrew/devex-308-bulk-start-should-ignore-already-running-workspaces branch July 9, 2026 15:13
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants