Skip to content

feat(explore): Add to filter option in heatmaps tooltip#116690

Merged
nikkikapadia merged 10 commits into
masterfrom
nikki/heat-maps-update-local-filters
Jun 4, 2026
Merged

feat(explore): Add to filter option in heatmaps tooltip#116690
nikkikapadia merged 10 commits into
masterfrom
nikki/heat-maps-update-local-filters

Conversation

@nikkikapadia
Copy link
Copy Markdown
Member

@nikkikapadia nikkikapadia commented Jun 2, 2026

few things being done here. Main thing is we've added another optional function to pass in to the HeatMapWidgetVisualization; the updateLocalFilterQuery function is a callback that updates the local url using the query that we pass it. So far it's only being used for the metrics product so we've passed in a metrics query updater.

Other things that were done in this PR

  • updated the heat maps story to reflect these changes
  • propagating the link to use navigate in a useEffect instead of the <a> tag. Without this the entire page reloads and navigation between filtered pages is not smooth (unfortunately the code is a little ugly for this 😭 but if anyone knows a better way to do this plz lemme know)
  • adding cursor specifications for the tooltip sections so it doesn't default to pointer
Screen.Recording.2026-06-03.at.11.31.09.AM.mov

Closes DAIN-1651

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

DAIN-1651

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.63% 93.63% ±0%
Typed 133,196 133,213 🟢 +17
Untyped 9,062 9,065 🔴 +3
🔍 3 new type safety issues introduced

Type assertions (as) (3 new)

File Line Detail
static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx 76 as Nodee.target as Node
static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx 79 as Elemente.target as Element
static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx 80 as Elemente.target as Element

This is informational only and does not block the PR.

Comment thread static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx Outdated
Comment thread static/app/views/explore/metrics/metricsHeatMap.tsx Outdated
const localQueryUpdateTarget = (e.target as Element).closest(
'[data-local-query-update-url]'
);
const tracesLinkTarget = (e.target as Element).closest('[data-traces-link]');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Text clicks break tooltip routing

Medium Severity

The document click handler calls closest on event.target cast to Element, but clicks on tooltip link labels often target a Text node, which has no closest. That throws before preventDefault, so client-side navigate is skipped and the browser follows href with a full page reload.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b81dc9d. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

idk what they're talking about the client side navigation works

Comment thread static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx Outdated
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 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

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 aa52596. Configure here.

Comment thread static/app/views/explore/metrics/metricsHeatMap.tsx Outdated
@nikkikapadia nikkikapadia marked this pull request as ready for review June 3, 2026 15:30
@nikkikapadia nikkikapadia requested review from a team as code owners June 3, 2026 15:30
Comment thread static/app/views/dashboards/widgets/heatMapWidget/heatMapWidgetVisualization.tsx Outdated
Comment on lines +67 to +73
// yes i am aware that this is UGLY but it's a hack so that we can use proper react routing.
// Basically the way ECharts renders the tooltip is by creating a string out of the dom tree.
// This means that we can't use any of the normal linking/routing tools that we use in React trees
// because they require contexts that won't be available properly in this string tree.
// Using the `<a>` tag will make the page reload and navigate to the url because it doesn't have
// link history context. Doing the navigation here preserves the link history context and makes the
// page navigation smoother instead of reloading the page every time a link is clicked.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😭

[metric, organization]
);

const getUpdatedMetricsQueryUrl = useCallback(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Since we're setting the query here, we may want to change the name

scale?: 'linear' | 'log';
/**
* getExploreUrl props that will be used to generate an explore link for the tooltip. Omitting this will not generate an explore link.
* Callback that returns an updated query string.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Since we're setting this directly and not returning anything in it, should the description be updated 👀

@nikkikapadia nikkikapadia merged commit 788aaab into master Jun 4, 2026
70 checks passed
@nikkikapadia nikkikapadia deleted the nikki/heat-maps-update-local-filters branch June 4, 2026 14:03
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