🤖 feat: show pending workspace states in sidebar #745
Merged
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
Shows immediate visual feedback in the sidebar when creating workspaces, instead of the UI appearing frozen during title generation (2-5s).
Changes
status?: 'creating'field toWorkspaceMetadatafor pending workspaces (ephemeral, not persisted)generatePlaceholderName()creates git-safe placeholder from user's messageFlow
Robustness
The implementation handles concurrent and edge-case scenarios correctly. Each workspace creation generates a unique ID upfront (
crypto.randomBytes), so multiple concurrent creations are fully isolated—the frontend'sworkspaceMetadataMap is keyed by workspace ID, and thebuildSortedWorkspacesByProjectfunction merges pending workspaces from metadata events with persisted config entries without duplication. If the user manually selects another workspace during creation, theonWorkspaceCreatedcallback uses a functional update (setSelectedWorkspace((current) => current !== null ? current : newSelection)) to avoid overwriting their choice.Window lifecycle is also handled safely. The backend's metadata event handler guards with
if (!this.mainWindow) return, so events are silently dropped when the renderer is closed—no errors or orphan state. Backend creation continues to completion and saves to config, so workspaces appear correctly on next app launch. The pendingstatus: "creating"field is ephemeral (never persisted), ensuring clean startup state regardless of when the window was closed.Generated with
mux