react-chartjs icon indicating copy to clipboard operation
react-chartjs copied to clipboard

this.state.chart is undefined at componentWillReceiveProps

Open alexfqc opened this issue 9 years ago • 2 comments

classData.componentWillReceiveProps = function(nextProps) { var chart = this.state.chart; // can be undefined if (chart) { // if not undefined then do the action if (nextProps.redraw) { chart.destroy(); this.initializeChart(nextProps); } else { dataKey = dataKey || dataKeys[chart.name]; updatePoints(nextProps, chart, dataKey); if (chart.scale) { chart.scale.xLabels = nextProps.data.labels;

          if (chart.scale.calculateXLabelRotation){
        chart.scale.calculateXLabelRotation();
          }
      }
      chart.update();
    }
  }
};

alexfqc avatar Mar 30 '17 20:03 alexfqc

@alex3165 it's in core.js right? please provide more data, where you're getting this? I have submitted pull request for this issue.

joshi-mehul avatar Aug 01 '17 06:08 joshi-mehul

@alexfqc, could you please provide an example where this is occurring ? Thanks

Jareechang avatar Jan 14 '18 21:01 Jareechang