Fix dev server visibility when switching sessions within a workspace (Vibe Kanban) #2016
+371
−44
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
This PR fixes a bug where dev servers would disappear from the preview panel when switching between sessions within the same workspace. The root cause was that the
ActionsContextwas using a session-scoped hook (useDevServer), which causedrunningDevServersto be empty when viewing a different session than the one that started the dev server.Changes
Backend (Rust)
crates/db/src/models/execution_process.rs): Addedfind_dev_servers_by_workspace()to query dev servers across all sessions in a workspacecrates/server/src/routes/execution_processes.rs): Added/stream/workspace-dev-servers/ws?workspace_id={id}for workspace-scoped dev server streamingcrates/services/src/services/events/streams.rs): Implementedstream_dev_servers_for_workspace_raw()that streams only dev server processes belonging to the specified workspaceFrontend (React/TypeScript)
frontend/src/hooks/useWorkspaceDevServers.ts): Low-level hook that connects to the workspace dev servers WebSocket streamusePreviewDevServer(frontend/src/components/ui-new/hooks/usePreviewDevServer.ts): Changed from session-scoped to workspace-scoped data sourceActionsContext(frontend/src/contexts/ActionsContext.tsx): Switched fromuseDevServertousePreviewDevServerfor workspace-scoped visibilityattemptIdprop since workspace ID is now sourced from contextWhy These Changes
Previously, dev servers were tracked at the session level. When a user started a dev server in Session A, then switched to Session B, the preview panel would show no running dev server because Session B's execution processes didn't include the dev server from Session A.
With this change, dev servers are now tracked at the workspace level, making them visible regardless of which session is currently active. This matches user expectations since dev servers are workspace-wide resources.
Implementation Details
useJsonPatchWsStream, similar streaming endpoints)This PR was written using Vibe Kanban