Skip to content

fix(explore): Fix attribute breakdowns tooltip caching stale params and losing values#112590

Merged
nsdeschenes merged 5 commits intomasterfrom
nd/fix-attr-comparisons-tooltip-hiding-values
Apr 14, 2026
Merged

fix(explore): Fix attribute breakdowns tooltip caching stale params and losing values#112590
nsdeschenes merged 5 commits intomasterfrom
nd/fix-attr-comparisons-tooltip-hiding-values

Conversation

@nsdeschenes
Copy link
Copy Markdown
Contributor

@nsdeschenes nsdeschenes commented Apr 9, 2026

Cache the rendered tooltip HTML and extracted value at hover time instead of storing raw echarts params and re-deriving them when frozen. This fixes the frozen tooltip showing stale or mismatched data when echarts re-invokes the formatter.

Closes EXP-869

Before Screenshot 2026-04-09 at 14 11 51
After Screenshot 2026-04-09 at 14 12 09

nsdeschenes and others added 2 commits April 9, 2026 14:05
Extract the tooltip value (name) into its own ref so it is captured at
hover time and remains stable when the tooltip is frozen. Previously the
value was derived from the cached params on each render, which could
lose the original value when echarts re-invokes the formatter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace tooltipParamsRef (which stored raw echarts params) with
tooltipContentRef (which stores the already-formatted HTML string).
This avoids re-calling the formatter with stale params when the
tooltip is frozen, preventing content from showing incorrect or
mismatched data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 9, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b34ed14. Configure here.

Comment thread static/app/views/explore/hooks/useAttributeBreakdownsTooltip.tsx Outdated
Comment thread static/app/views/explore/hooks/useAttributeBreakdownsTooltip.tsx
nsdeschenes and others added 3 commits April 9, 2026 14:30
Replace tooltipParamsRef (which stored raw echarts params) with
tooltipContentRef (which stores the already-formatted HTML string).
This avoids re-calling the formatter with stale params when the
tooltip is frozen, preventing content from showing incorrect or
mismatched data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tooltipValueRef was initialized as useRef<string>(''), so .current was
always a string and the ?? fallback to derive the value from params
could never trigger. Initialize as null to match tooltipContentRef,
allowing proper fallback when the ref hasn't been populated before
the tooltip is frozen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
handleMouseLeave was resetting tooltipValueRef to '' instead of null,
which meant the ?? fallback could never trigger since nullish
coalescing doesn't fall through on empty strings. Align with
handleClickAnywhere which correctly uses null.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nsdeschenes nsdeschenes marked this pull request as ready for review April 9, 2026 17:39
@nsdeschenes nsdeschenes requested a review from a team as a code owner April 9, 2026 17:39
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 9, 2026

@nsdeschenes nsdeschenes merged commit d6a8f84 into master Apr 14, 2026
67 checks passed
@nsdeschenes nsdeschenes deleted the nd/fix-attr-comparisons-tooltip-hiding-values branch April 14, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants