[claude] fix(benchmarks-website): preserve visible center on chart scope change#7781
Merged
connortsui20 merged 1 commit intoct/benchmarks-v3from May 4, 2026
Merged
Conversation
The toolbar slider's `applyScope` always called `visibleRange` which
unconditionally returned the right-anchored window
`[maxIdx - (scope - 1), maxIdx]`. So any scope change while the user
had pan-scrolled to inspect a historical window snapped the chart back
to the most-recent commits — losing whatever they were looking at.
Pass 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
preserved — that is still the right default at first load and after
"show all". Pan/zoom callbacks are unchanged: they go through
`rebuildVisibleAndUpdate` directly, not `applyScope`.
Bump `STATIC_ASSET_VERSION` to `bench-v3-ui-17` so cached browsers
pick up the new JS, and refresh the snapshot tests that reference the
versioned asset URLs.
Signed-off-by: Claude <noreply@anthropic.com>
b9d2f55 to
3796974
Compare
Merging this PR will improve performance by 33.23%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | new_bp_prim_test_between[i64, 32768] |
236.4 µs | 177.4 µs | +33.23% |
Comparing claude/benchmarks-v3-zoom-preserve-center (3796974) with ct/benchmarks-v3 (116e5a7)
Footnotes
-
138 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
connortsui20
added a commit
that referenced
this pull request
May 4, 2026
…ope 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
applyScopecallsvisibleRange(commitCount, scope)on every sliderinput, andvisibleRangealways returned[maxIdx - (scope - 1), maxIdx],i.e. unconditionally right-anchored. This commit threads the chart's
current
chart.options.scales.x.{min, max}intovisibleRangeso it canpreserve 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/onZoomcontinue to routethrough
rebuildVisibleAndUpdatedirectly (notapplyScope), so theydon't regress, and
syncSliderFromRangestill updates the slider readouton every pan.
The fix is purely client-side: no refetch, no server-side commit cap
change, no slider re-binding.
STATIC_ASSET_VERSIONis bumped tobench-v3-ui-17so cached browsers pick up the new JS; the threesnapshot files that embed the version string are refreshed.
Files
benchmarks-website/server/static/chart-init.js—visibleRangetakesan optional
currentRange;applyScopereads the chart's current{x.min, x.max}and passes it through. Added an invariant commentabove
visibleRangeper the request to document the new behaviour.benchmarks-website/server/src/html.rs— bumpSTATIC_ASSET_VERSION.benchmarks-website/server/tests/snapshots/{landing_page,chart_page_query,group_page_query}.snap— version string refresh.Test plan
cargo test -p vortex-bench-server— 54/54 pass (21 lib + 10ingest + 23 web_ui snapshots)
cargo +nightly fmt --all— cleancargo clippy -p vortex-bench-server --all-targets --all-features—clean
/healthreturns OK,/static/chart-init.jsservesthe new
visibleRange(commitCount, scope, currentRange)signature, thelanding page references
chart-init.js?v=bench-v3-ui-17.drag the toolbar slider — visible window should grow/shrink around
the current center, not snap to the newest commits.
Generated by Claude Code