perf(charts): Speed up Heat Map drag-to-zoom#119346
Conversation
The Heat Map's drag-to-select box was janky and got worse as the heat map gained cells. Root cause: it used ECharts' `brush`, whose per-move `brush` action forces a full `updateVisual` re-render of every series (an O(cells) rebuild) on every mouse-move. Replace the brush with a self-drawn selection overlay: a fixed-position element tracks the drag with no chart re-render, and on mouse-up the pixel corners are converted to time/value bounds via `convertFromPixel` on the readable axes. The `onZoom` contract is unchanged, so navigation/refetch applies the zoom exactly as before. The tooltip is hidden during the drag and restored shortly after release, and Esc cancels an in-progress selection. Removes the now-unused `pickBoxZoomRange` helper. Refs DAIN-1772 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@cursor review |
📊 Type Coverage Diff
🔍 4 new type safety issues introducedType assertions (
This is informational only and does not block the PR. |
Address review + CI feedback on the box-zoom overlay: - Reject selections that collapse to zero width on either axis after `convertFromPixel` (not just non-finite ones), so a drag can't navigate to bounds that match no data. - End a stuck drag if a mousemove arrives with the primary button released (a missed mouseup, e.g. released outside the window), and tear down any prior drag on mousedown so overlays/listeners can't stack. - Drop the now-unused `export` on `EChartBrushArea` (and its dead `coordRanges` field), left over from the removed `pickBoxZoomRange`, which knip flagged. Refs DAIN-1772 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit eb4a1f1. Configure here.
| if (range) { | ||
| onZoomRef.current?.(range); | ||
| } | ||
| } |
There was a problem hiding this comment.
MouseUp ignores auxiliary buttons
Medium Severity
The document mouseup handler ends an active drag on any button release, but mousedown only starts a selection for the primary button. A secondary or middle mouseup while the primary button is still down tears down the overlay and can fire onZoom using the wrong pointer position, producing an incorrect heat map zoom.
Reviewed by Cursor Bugbot for commit eb4a1f1. Configure here.
The document `mouseup` handler ended an active drag on any button release, but a drag only starts on the primary button. Releasing a secondary/middle button mid-drag (primary still held) would tear down the overlay and could fire `onZoom` at the wrong pointer position. Ignore non-primary releases. Refs DAIN-1772 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-c0w5jg7fj.sentry.dev |


Replaces the metrics Heat Map's drag-to-zoom implementation. The selection box is now drawn as a lightweight DOM overlay instead of ECharts'
brushcomponent.The diff is useless here, it's basically a whole new file! The new implementation draws an HTML
divover the chart as the drag, which is much faster.If you're curious, here's a profile of a mouse move before:
You can clearly see a needless ECharts render, a re-layout, etc. It's like 75ms for all that. The after is trivially fast:
Closes DAIN-1772, DAIN-1776