Commit ac179e5
authored
🤖 fix: add loading state to ProjectContext to fix Storybook race (#960)
The SingleProject story sometimes failed to show workspace creation
controls because of a race between two async operations:
1. **ProjectContext** loads projects via `api.projects.list()`
2. **WorkspaceContext** loads workspaces via `api.workspace.list()`
When `WorkspaceContext.loading` became `false`, App would render but
projects might still be empty (size 0), causing the condition
`projects.size === 1` to be false, so `creationProjectPath` was null.
**Fix:** Add a `loading` state to ProjectContext and gate on it in
AppLoaderInner alongside `workspaceContext.loading`.
_Generated with `mux`_1 parent 2c5f8b0 commit ac179e5
File tree
2 files changed
+13
-4
lines changed- src/browser
- components
- contexts
2 files changed
+13
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
76 | | - | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
224 | 230 | | |
225 | 231 | | |
226 | 232 | | |
| 233 | + | |
227 | 234 | | |
228 | 235 | | |
229 | 236 | | |
| |||
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
| 249 | + | |
242 | 250 | | |
243 | 251 | | |
244 | 252 | | |
| |||
0 commit comments