Commit 735e650
authored
🤖 feat: show pending workspace states in sidebar (#745)
## 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`_1 parent 5874155 commit 735e650
File tree
9 files changed
+378
-122
lines changed- src
- browser
- components
- contexts
- utils/ui
- common/types
- node/services
9 files changed
+378
-122
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
| 201 | + | |
203 | 202 | | |
204 | 203 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
218 | 217 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 218 | + | |
241 | 219 | | |
242 | 220 | | |
243 | 221 | | |
| |||
605 | 583 | | |
606 | 584 | | |
607 | 585 | | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
614 | 599 | | |
615 | 600 | | |
616 | 601 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
106 | 111 | | |
107 | | - | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
112 | 118 | | |
113 | | - | |
114 | | - | |
| 119 | + | |
| 120 | + | |
115 | 121 | | |
| 122 | + | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| |||
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
127 | | - | |
| 134 | + | |
128 | 135 | | |
129 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
130 | 144 | | |
131 | 145 | | |
132 | 146 | | |
| |||
147 | 161 | | |
148 | 162 | | |
149 | 163 | | |
150 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
151 | 168 | | |
| 169 | + | |
152 | 170 | | |
153 | 171 | | |
154 | 172 | | |
155 | | - | |
| 173 | + | |
156 | 174 | | |
157 | | - | |
| 175 | + | |
158 | 176 | | |
159 | 177 | | |
160 | 178 | | |
| |||
165 | 183 | | |
166 | 184 | | |
167 | 185 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
174 | 194 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
191 | 213 | | |
192 | 214 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
203 | 227 | | |
204 | 228 | | |
205 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| |||
223 | 226 | | |
224 | 227 | | |
225 | 228 | | |
226 | | - | |
227 | | - | |
228 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
229 | 233 | | |
230 | 234 | | |
231 | 235 | | |
| |||
0 commit comments