Commit 1f3d0a9
committed
fix(grid): column sort beyond 1st click — listen to order-notify too
**Root cause**: `connect_primary_sort_column_notify` in `grid.rs` only
fires when the primary sort *column* changes. Clicking the same
column a second time keeps the column constant — GTK only flips the
direction (Ascending ↔ Descending). The chevron icon updates
because GTK manages it internally, but the model never sees a
SortChanged dispatch, so `current_sort` stays stale and the next
FetchPage emits the same `ORDER BY` clause as the previous one.
End result: chevron flips, data doesn't.
**Fix**:
1. Wire `connect_primary_sort_order_notify` alongside
`connect_primary_sort_column_notify`. Either signal now
dispatches SortChanged.
2. Pass the post-click `(col_idx, ascending)` directly in the
message instead of toggling at the receiver. Reading off the
sorter is idempotent — both notify signals carry the same
resolved pair, so receiver short-circuits when it already
matches `current_sort`. Without the short-circuit, clicking a
different column (which fires BOTH notifies because column
changes AND order resets) would have flipped twice.
`GridMsg::SortChanged(usize)` → `SortChanged(usize, bool)`.
`BrowseTabInput::SortChanged(usize)` →
`SortChanged { col_idx, ascending }`. Receiver no longer holds
toggle state — sorter is the source of truth.1 parent bb71907 commit 1f3d0a9
2 files changed
Lines changed: 59 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
| |||
1348 | 1351 | | |
1349 | 1352 | | |
1350 | 1353 | | |
1351 | | - | |
| 1354 | + | |
1352 | 1355 | | |
1353 | 1356 | | |
1354 | 1357 | | |
| |||
1543 | 1546 | | |
1544 | 1547 | | |
1545 | 1548 | | |
1546 | | - | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
1552 | 1561 | | |
1553 | 1562 | | |
1554 | 1563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
177 | 205 | | |
178 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
179 | 211 | | |
| 212 | + | |
180 | 213 | | |
181 | 214 | | |
182 | 215 | | |
| |||
0 commit comments