Skip to content

fix(metrics): Add missing 'return' statement in <WidgetDetails /> #70512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2024
Merged

fix(metrics): Add missing 'return' statement in <WidgetDetails /> #70512

merged 1 commit into from
May 21, 2024

Conversation

floels
Copy link
Contributor

@floels floels commented May 8, 2024

Goal

The goal of this PR is to add a missing return statement in the rendering logic of the <WidgetDetails /> component defined in static/app/views/metrics:

if (selectedWidget?.type === MetricExpressionType.EQUATION) {
<MetricDetails onRowHover={handleSampleRowHover} focusArea={focusArea} />;
}

This return was most likely forgotten when writing this piece of code. This probably doesn't result in any bug: by incorrectly continuing the rendering function, we end up also rendering a <MetricDetails /> component with undefined mri, op and query.

The code makes more sense with the return statement though.

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.

Add a missing 'return' statement in the rendering logic of the
<WidgetDetails /> component defined in 'static/app/views/metrics'.
@floels floels requested a review from a team as a code owner May 8, 2024 15:56
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 8, 2024
Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 80.00%. Comparing base (fd8d3df) to head (175186f).
Report is 374 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #70512      +/-   ##
==========================================
+ Coverage   79.97%   80.00%   +0.03%     
==========================================
  Files        6495     6495              
  Lines      289790   289919     +129     
  Branches    49928    49947      +19     
==========================================
+ Hits       231753   231950     +197     
+ Misses      57625    57558      -67     
+ Partials      412      411       -1     
Files Coverage Δ
static/app/views/metrics/widgetDetails.tsx 0.00% <0.00%> (ø)

... and 70 files with indirect coverage changes

Copy link
Member

@evanpurkhiser evanpurkhiser left a comment

Choose a reason for hiding this comment

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

Looks important @edwardgou-sentry can you take a look?

@evanpurkhiser evanpurkhiser added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label May 14, 2024
@evanpurkhiser
Copy link
Member

/gcbrun

Copy link
Contributor

@edwardgou-sentry edwardgou-sentry left a comment

Choose a reason for hiding this comment

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

Code looks fine, but I don't think this actually changes anything because we return MetricDetails on L60 anyways, and those props are optional.

cc: @obostjancic might be more familiar with the metrics page

@floels
Copy link
Contributor Author

floels commented May 18, 2024

Thanks @evanpurkhiser and @edwardgou-sentry for the review! Do you think we can get this merged?

Copy link
Member

@ArthurKnaus ArthurKnaus left a comment

Choose a reason for hiding this comment

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

@edwardgou-sentry is right this will not change any behaviour. Though it is cleaner.
thx for fixing @floels 🙌
We should use the proper type guards here. Will do in a follow-up.

@ArthurKnaus ArthurKnaus merged commit 276d1d5 into getsentry:master May 21, 2024
45 of 47 checks passed
ArthurKnaus added a commit that referenced this pull request May 21, 2024
Use type guard and remove casting in widget details.

- follow-up of #70512
cmanallen pushed a commit that referenced this pull request May 21, 2024
…0512)

# Goal

The goal of this PR is to add a missing `return` statement in the
rendering logic of the `<WidgetDetails />` component defined in
`static/app/views/metrics`:


https://github.com/getsentry/sentry/blob/6b530ffab46d0b50512f0f4c9df8d084c1feb831/static/app/views/metrics/widgetDetails.tsx#L54-L56

This `return` was most likely forgotten when writing this piece of code.
This probably doesn't result in any bug: by incorrectly continuing the
rendering function, we end up also rendering a `<MetricDetails />`
component with `undefined` `mri`, `op` and `query`.

The code makes more sense with the `return` statement though.

# 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.
cmanallen pushed a commit that referenced this pull request May 21, 2024
Use type guard and remove casting in widget details.

- follow-up of #70512
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants