Commit 1adeaec
authored
🤖 fix: deterministic project ordering when no custom order set (#1213)
## Problem
The Comprehensive demo story had flaky snapshots because projects in the
sidebar did not render in a consistent order when `projectOrder` was
empty (initial state in Storybook).
**Root cause:** `sortProjectsByOrder()` returned projects in Map
insertion order when `order` was empty. Map insertion order depends on
how data is constructed, making it non-deterministic across test runs.
## Solution
When no custom order is set, sort projects lexically instead of using
insertion order. This guarantees a stable, deterministic render order.
## Impact
- **Storybook:** Projects render in consistent alphabetical order when
no custom ordering is saved
- **Production:** New users see projects sorted alphabetically until
they drag-reorder
- **Existing users:** No change—their saved `projectOrder` is non-empty,
so existing sort logic applies
---
_Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking:
`high`_1 parent 682a04c commit 1adeaec
2 files changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
0 commit comments