Skip to content

ref(discover): Convert ResultsChart components to functional - #125150

Open
sentry[bot] wants to merge 2 commits into
masterfrom
seer/ref/discover-results-chart-functional
Open

sentry[bot] wants to merge 2 commits into
masterfrom
seer/ref/discover-results-chart-functional

Conversation

@sentry

@sentry sentry Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This PR converts two React class components, ResultsChart and ResultsChartContainer, located in static/app/views/discover/results/resultsChart.tsx, into functional components using React hooks.

Specifically, for ResultsChartContainer:

  • The yAxisOptions state and UNSAFE_componentWillReceiveProps lifecycle method have been replaced with a useMemo hook to derive yAxisOptions from eventView.
  • The shouldComponentUpdate method has been replaced by wrapping the functional component in React.memo with a custom comparison function.
  • The CustomMeasurementsContext.Consumer render prop has been updated to use the useContext hook.
  • The withApi Higher-Order Component has been removed, and the api client is now obtained using the useApi hook directly within the component.

For ResultsChart:

  • The shouldComponentUpdate method has been replaced by wrapping the functional component in React.memo with a custom comparison function.

These changes align the components with the project's no-class-components coding convention, improving maintainability and leveraging modern React practices.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes CODING-CONVENTIONS-4R7

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
@sentry
sentry Bot requested a review from a team as a code owner September 21, 2026 22:55
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 95.56% 95.56% ±0%
Typed 140,020 140,024 🟢 +4
Untyped 6,511 6,510 🟢 -1
🔍 1 new type safety issue introduced

any-typed symbols (1 new)

File Line Detail
static/app/views/discover/results/resultsChart.tsx 180 api (var)

This is informational only and does not block the PR.

@ryan953
ryan953 requested a review from a team September 21, 2026 23:10
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.

1 participant