fix(dashboards): Stop chart drag-to-zoom selecting the wrong time range#119013
Open
gggritso wants to merge 1 commit into
Open
fix(dashboards): Stop chart drag-to-zoom selecting the wrong time range#119013gggritso wants to merge 1 commit into
gggritso wants to merge 1 commit into
Conversation
Dragging to zoom on a dashboard time-series widget could update the global time filter to the wrong (collapsed) range. The widget inherited BaseChart's notMerge=true default, so every data refresh did a full ECharts re-init that re-created the toolbox dataZoom "select" component. On ECharts 6.1 that rebuild re-emits a stale `dataZoom` event, so a single drag cascaded into repeated refetches that settled on a wrong, collapsed range (see apache/echarts#21661). Force merge mode and remove the notMerge prop entirely so it can't be re-enabled: the existing replaceMerge already fully replaces the volatile series/axes, which was the only reason notMerge was ever reached for. Update the explore callers (metrics, spans, logs) that passed notMerge accordingly. Fixes DAIN-1753 Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-le5uzmcc4.sentry.dev |
Member
Author
|
@cursor review |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8047a99. Configure here.
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.
Dragging to zoom on a dashboard time-series widget could snap the global time filter to the wrong (collapsed) range — e.g. a ~2h selection landing on ~1 minute.
Two related bugs in Dashboards time series chart navigation
It looks like the root cause is apache/echarts#21661, in which re-mounting a chart reinitiates the zoom toolbox, which weirdly re-fires old zoom events? Truly bizarre. To guard against this, allowing
notMerge=falsemakes sure that ECharts doesn't do a full re-init of the toolbox, it just updates it if it changed (it didn't), which prevents this weird re-initialization loop.I worked through this with Claude for a while, and I'm convinced that the solution works. Since
notMergeis able to cause broken UI, I removed that prop completely.This is the same root cause as LOGS-901.
Fixes DAIN-1753
Investigation notes
Verified live with temporary console instrumentation on the repro dashboard (single time-series widget)
Repro: drag-zoom (~2h) → dashboard Cancel → drag-zoom again → second selection collapses to a wrong, tiny range and the selection rectangle looks more opaque.
Two theories were disproven by the logs, not assumed:
0/0or1/1) — no orphans.What the logs actually showed: a single drag fired
handleDataZoom3–6 times, each with a differentfrom: toolbox-feature_NNNuid climbing by +26 and a drifting range (10 → 126 → 126 → 126 → 12min); the last write won and it was the stale collapsed one.unbindEvents()/bindEvents()on every update, and the events had differentfrom/ranges (a single event to N stale listeners would be identical N times). These are N genuinely distinct dispatches.notMergere-init.setPeriod→ URL/page-filter change → widget re-render →setOption(notMerge:true)full re-init → toolbox dataZoom re-emits adataZoom→setPeriod→ … until it settles on a drifted/collapsed range.Fix confirmation: with
notMerge={false}, each drag fireshandleDataZoomexactly once, thefromuid stays stable, and both drags land the correct ~2h range (117 / 119 min).Upstream: apache/echarts#21661 (open, "pending") is the same regression; #21644/#21669 are related. No merged upstream fix exists, so this is a client-side mitigation.
Blast radius: dashboards, insights, and all explore time-series charts now merge (they shared the latent bug; metrics/spans were already on
notMerge={false}).