diff --git a/src/components/controls/color-by.js b/src/components/controls/color-by.js index 2d6b5f746..ac24b136c 100644 --- a/src/components/controls/color-by.js +++ b/src/components/controls/color-by.js @@ -101,6 +101,18 @@ class ColorBy extends React.Component { } } + /** + * Avoids double invocation of change() method + */ + shouldComponentUpdate(_, nextState) { + if (this.state.colorBySelected === nextState.colorBySelected && + this.state.geneSelected === nextState.geneSelected && + this.state.positionSelected === nextState.positionSelected) { + return false; + } + return true; + } + dispatchColorBy(colorBy, name = colorBy) { analyticsControlsEvent(`color-by-${name}`); this.props.dispatch(changeColorBy(colorBy));