Commit 5327bdd
Fix custom model add requiring two attempts + enlarge sidebar buttons (#1805)
## Motivation
Adding a custom model from the Hub tab shows "Added" toast but the model
doesn't appear in the All tab. You have to add it a second time for it
to work. Also, the "All" button in the model picker sidebar is too small
to read comfortably.
## Changes
**Race condition fix (`src/exo/api/main.py`):**
- Call `add_to_card_cache(card)` directly in `add_custom_model()` after
sending the `ForwarderCommand`, before the API response returns
**Sidebar sizing
(`dashboard/src/lib/components/FamilySidebar.svelte`):**
- Increased sidebar min-width from 72/64px to 80/72px
- Increased "All" icon from `w-5 h-5` to `w-6 h-6`
- Increased all sidebar labels from 9px to 11px
## Why It Works
`POST /models/add` sends a `ForwarderCommand(AddCustomModelCard)` and
returns immediately. The frontend then calls `GET /models` which reads
from `_card_cache`. But the cache was only updated by the worker event
handler after the event round-trips through the master — a race the
frontend almost always loses. By updating the cache directly in the API
handler, `GET /models` immediately reflects the new model. The worker's
later `add_to_card_cache` call is idempotent (dict key assignment).
## Test Plan
### Manual Testing
<!-- Hardware: any Mac -->
- Open model picker → Hub tab → add a custom model → verify it appears
in All tab on the first attempt
- Verify sidebar "All" button and other labels are visually larger and
readable
### Automated Testing
- `uv run basedpyright` passes with 0 errors
- `uv run ruff check` passes
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 15f1b61 commit 5327bdd
3 files changed
Lines changed: 13 additions & 19 deletions
File tree
- dashboard/src/lib/components
- src/exo/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 57 | | |
69 | | - | |
| 58 | + | |
70 | 59 | | |
71 | 60 | | |
72 | 61 | | |
| |||
90 | 79 | | |
91 | 80 | | |
92 | 81 | | |
93 | | - | |
| 82 | + | |
94 | 83 | | |
95 | 84 | | |
96 | 85 | | |
| |||
115 | 104 | | |
116 | 105 | | |
117 | 106 | | |
118 | | - | |
| 107 | + | |
119 | 108 | | |
120 | 109 | | |
121 | 110 | | |
| |||
139 | 128 | | |
140 | 129 | | |
141 | 130 | | |
142 | | - | |
| 131 | + | |
143 | 132 | | |
144 | 133 | | |
145 | 134 | | |
| |||
165 | 154 | | |
166 | 155 | | |
167 | 156 | | |
168 | | - | |
| 157 | + | |
169 | 158 | | |
170 | 159 | | |
171 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
1587 | 1588 | | |
1588 | 1589 | | |
1589 | 1590 | | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
1590 | 1595 | | |
1591 | 1596 | | |
1592 | 1597 | | |
| |||
0 commit comments