diff --git a/client/src/components/continuous/continuous.js b/client/src/components/continuous/continuous.js index 226b6d0f..5288d5b2 100644 --- a/client/src/components/continuous/continuous.js +++ b/client/src/components/continuous/continuous.js @@ -51,10 +51,6 @@ class Continuous extends React.Component { dimensions: null }; } - componentDidMount() {} - componentWillReceiveProps(nextProps) {} - - componentDidMount() {} handleBrushAction(selection) { this.props.dispatch({ type: "continuous selection using parallel coords brushing", diff --git a/client/src/components/continuousLegend/index.js b/client/src/components/continuousLegend/index.js index 34b89161..e0aa3b1a 100644 --- a/client/src/components/continuousLegend/index.js +++ b/client/src/components/continuousLegend/index.js @@ -102,27 +102,26 @@ class ContinuousLegend extends React.Component { super(props); this.state = {}; } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { if ( - nextProps.colorAccessor !== this.props.colorAccessor || - nextProps.responsive.height !== this.props.responsive.height || - nextProps.responsive.width !== this.props.responsive.width + prevProps.colorAccessor !== this.props.colorAccessor || + prevProps.responsive.height !== this.props.responsive.height || + prevProps.responsive.width !== this.props.responsive.width ) { /* always remove it, if it's not continuous we don't put it back. */ - d3 - .select("#continuous_legend") + d3.select("#continuous_legend") .selectAll("*") .remove(); } - if (nextProps.colorAccessor && nextProps.colorScale) { + if (this.props.colorAccessor && this.props.colorScale) { /* fragile! continuous range is 0 to 1, not [#fa4b2c, ...], make this a flag? */ - if (nextProps.colorScale.range()[0][0] !== "#") { + if (this.props.colorScale.range()[0][0] !== "#") { continuous( "#continuous_legend", d3 .scaleSequential(d3.interpolateViridis) - .domain(nextProps.colorScale.domain()) + .domain(this.props.colorScale.domain()) ); } }