Commit 4a97c94
[claude] fix(benchmarks-website): preserve visible center on chart scope change (#7781)
## Summary
Adjusting a chart's zoom (toolbar slider, future zoom shortcuts) while
the
user had pan-scrolled to a historical window was snapping the visible
range back to the most recent N commits — losing whatever they were
inspecting.
`applyScope` calls `visibleRange(commitCount, scope)` on every slider
`input`, and `visibleRange` always returned `[maxIdx - (scope - 1),
maxIdx]`,
i.e. unconditionally right-anchored. This commit threads the chart's
current `chart.options.scales.x.{min, max}` into `visibleRange` so it
can
preserve the visible CENTER when the chart is already panned away from
the right edge.
When the chart is at the right edge or already covers everything, the
right-anchor behavior is unchanged — that is still the right default at
first load and after "show all". `onPan` / `onZoom` continue to route
through `rebuildVisibleAndUpdate` directly (not `applyScope`), so they
don't regress, and `syncSliderFromRange` still updates the slider
readout
on every pan.
The fix is purely client-side: no refetch, no server-side commit cap
change, no slider re-binding. `STATIC_ASSET_VERSION` is bumped to
`bench-v3-ui-17` so cached browsers pick up the new JS; the three
snapshot files that embed the version string are refreshed.
## Files
- `benchmarks-website/server/static/chart-init.js` — `visibleRange`
takes
an optional `currentRange`; `applyScope` reads the chart's current
`{x.min, x.max}` and passes it through. Added an invariant comment
above `visibleRange` per the request to document the new behaviour.
- `benchmarks-website/server/src/html.rs` — bump `STATIC_ASSET_VERSION`.
-
`benchmarks-website/server/tests/snapshots/{landing_page,chart_page_query,group_page_query}.snap`
— version string refresh.
## Test plan
- [x] `cargo test -p vortex-bench-server` — 54/54 pass (21 lib + 10
ingest + 23 web_ui snapshots)
- [x] `cargo +nightly fmt --all` — clean
- [x] `cargo clippy -p vortex-bench-server --all-targets --all-features`
—
clean
- [x] Local smoke: `/health` returns OK, `/static/chart-init.js` serves
the new `visibleRange(commitCount, scope, currentRange)` signature, the
landing page references `chart-init.js?v=bench-v3-ui-17`.
- [ ] Manual UI smoke (browser): expand a group, pan to mid-history,
drag the toolbar slider — visible window should grow/shrink around
the current center, not snap to the newest commits.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01U5VP7x7Tduk2GX7DSjP5Hk)_
Signed-off-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 116e5a7 commit 4a97c94
5 files changed
Lines changed: 39 additions & 7 deletions
File tree
- benchmarks-website/server
- src
- static
- tests/snapshots
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1165 | 1165 | | |
1166 | 1166 | | |
1167 | 1167 | | |
1168 | | - | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1169 | 1175 | | |
1170 | 1176 | | |
1171 | 1177 | | |
1172 | 1178 | | |
1173 | 1179 | | |
1174 | | - | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1175 | 1202 | | |
1176 | 1203 | | |
1177 | 1204 | | |
| |||
1181 | 1208 | | |
1182 | 1209 | | |
1183 | 1210 | | |
1184 | | - | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
1185 | 1217 | | |
1186 | 1218 | | |
1187 | 1219 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
0 commit comments