Commit d29d26d
authored
🤖 Preserve git status on timeout/failure (#251)
## Problem
When git status checks fail (timeout, parse error, network issues), the
store was clearing the cached status and setting it to `null`. This
caused the git indicators in the UI to disappear during transient
failures, creating visual flicker and losing useful information.
**Before:**
```
timeout → status cleared → indicator disappears → next poll → indicator reappears
```
**After:**
```
timeout → old status preserved → indicator remains stable
```
## Solution
Only update `statusCache` when the new status check succeeds (non-null).
On failure:
- Keep the old cached status
- Don't bump the version (no re-render)
- Silent degradation - stale data is better than no data
```typescript
if (!this.areStatusesEqual(oldStatus, newStatus)) {
if (newStatus !== null) { // ✅ Only update on success
this.statusCache.set(workspaceId, newStatus);
this.statuses.bump(workspaceId);
}
// On failure: keep old status, don't bump
}
```
## Scenarios This Helps
1. **Slow network/disk** - 5 second timeout may be too aggressive for
large repos with remote on slow connection
2. **Transient failures** - Network hiccup, disk busy (antivirus,
backup), workspace temporarily unmounted
3. **Repository issues** - Corruption, remote unreachable (better to
show last known state than hide indicator)
## Testing
Added unit tests to verify:
- Old status is preserved when `checkWorkspaceStatus` returns null
- Status updates normally when checks succeed after previous failures
- No re-renders occur when status check fails (listeners not called)
All 489 tests pass.
_Generated with `cmux`_1 parent 4a4f628 commit d29d26d
2 files changed
+75
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
268 | 336 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| |||
0 commit comments