Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Nov 25, 2025

Summary

Shows immediate visual feedback in the sidebar when creating workspaces, instead of the UI appearing frozen during title generation (2-5s).

Changes

  • Type: Added status?: 'creating' field to WorkspaceMetadata for pending workspaces (ephemeral, not persisted)
  • Backend: Emits pending metadata immediately before slow AI title generation, clears on error
  • Helper: generatePlaceholderName() creates git-safe placeholder from user's message
  • Frontend: Shows shimmer on workspace name, disables selection/remove actions during creation

Flow

User sends message → Backend emits pending metadata immediately → 
Sidebar shows workspace with shimmer → AI generates title (2-5s) → 
Backend creates workspace → Backend emits final metadata → 
Sidebar updates to real name, removes shimmer

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's workspaceMetadata Map is keyed by workspace ID, and the buildSortedWorkspacesByProject function merges pending workspaces from metadata events with persisted config entries without duplication. If the user manually selects another workspace during creation, the onWorkspaceCreated callback 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 pending status: "creating" field is ephemeral (never persisted), ensuring clean startup state regardless of when the window was closed.


Generated with mux

@ammar-agent ammar-agent force-pushed the sidebar-pending-workspace-states branch 5 times, most recently from 379f584 to e3a4ecd Compare December 1, 2025 20:44
@ammar-agent ammar-agent force-pushed the sidebar-pending-workspace-states branch 2 times, most recently from 52e29ae to 2db4c08 Compare December 2, 2025 17:13
- Add status?: 'creating' field to WorkspaceMetadata for pending workspaces
- Backend emits pending metadata immediately before slow AI title generation
- generatePlaceholderName() creates git-safe placeholder from user's message
- Frontend shows shimmer on workspace name during creation
- Disable selection/remove actions while workspace is being created
- Clear pending state on error by emitting null metadata

This provides immediate visual feedback when creating workspaces instead of
the UI appearing frozen during title generation (2-5s).
Extract buildSortedWorkspacesByProject utility to handle both persisted
and pending (status: creating) workspaces. Pending workspaces are now
displayed in the sidebar immediately when workspace creation starts,
rather than waiting for the config to be saved.

This fixes concurrent workspace creation where multiple workspaces
were being created simultaneously but only appeared after completion.
@ammar-agent ammar-agent force-pushed the sidebar-pending-workspace-states branch from 2db4c08 to e550795 Compare December 2, 2025 17:36
- Extract sanitizeBranchName() to deduplicate validation logic
- Remove redundant Map.set() after in-place sort
- Add isDisabled flag to consolidate isCreating || isDeleting checks
- Improve aria-label for deleting state
@ammar-agent ammar-agent force-pushed the sidebar-pending-workspace-states branch from e550795 to 626a866 Compare December 2, 2025 17:43
@ammario ammario merged commit 735e650 into main Dec 2, 2025
13 checks passed
@ammario ammario deleted the sidebar-pending-workspace-states branch December 2, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants