-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
[Explore] Handle empty metrics control data #5241
[Explore] Handle empty metrics control data #5241
Conversation
@@ -223,7 +223,7 @@ export default class AdhocFilterControl extends React.Component { | |||
} else if (option instanceof AdhocMetric) { | |||
return { ...option, filterOptionName: '_adhocmetric_' + option.label }; | |||
} | |||
return null; | |||
return ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to return an empty string here? Generally checking for null
is preferable to an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caller for these 2 optionsForSelect
functions expecting a string array result, and don't handle null
in the array. if i return null and caller brought result to do sort, another exception will be thrown.
So i come up another solution that combines filter (empty metrics) + map metrics to new attribute name.
2be21b9
to
938f89f
Compare
938f89f
to
b1c6771
Compare
Codecov Report
@@ Coverage Diff @@
## master #5241 +/- ##
==========================================
+ Coverage 60.76% 60.78% +0.01%
==========================================
Files 258 258
Lines 19701 19700 -1
Branches 1970 1970
==========================================
+ Hits 11972 11974 +2
+ Misses 7720 7717 -3
Partials 9 9
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(cherry picked from commit 13cbf80)
when metrics is empty, Explore controls throw exceptions:
I think js bundle for notify library is also problematic. We probably should remove the usage and replace with other library. But it's out of scope of this issue.
@GabeLoins @timifasubaa @michellethomas @mistercrunch