Correctly check if mini histograms shouldn't be rendered (#1809)

* ensure that function returns a boolean value

* change function used to check if mini histogram should not render
This commit is contained in:
Severiano Badajoz
2020-09-01 16:45:50 -07:00
committed by GitHub
parent 54b42607ae
commit 437fd5feda
@@ -81,7 +81,7 @@ class CategoryValue extends React.Component {
get shouldRenderStackedBarOrHistogram() { get shouldRenderStackedBarOrHistogram() {
const { colorAccessor, isColorBy, annotations } = this.props; const { colorAccessor, isColorBy, annotations } = this.props;
return colorAccessor && !isColorBy && !annotations.isEditingLabelName; return !!colorAccessor && !isColorBy && !annotations.isEditingLabelName;
} }
handleDeleteValue = () => { handleDeleteValue = () => {
@@ -439,7 +439,9 @@ class CategoryValue extends React.Component {
if ( if (
!this.shouldRenderStackedBarOrHistogram || !this.shouldRenderStackedBarOrHistogram ||
!AnnotationsHelpers.isContinuousAnnotation(schema, colorAccessor) // This function returns true on categorical annotations(when stacked bar should not render),
// in cases where the colorAccessor is a gene this function will return undefined since genes do not live on the schema
AnnotationsHelpers.isCategoricalAnnotation(schema, colorAccessor) === true
) { ) {
return null; return null;
} }