From 1736987f37dc51ef18483585d913b8b4e610b595 Mon Sep 17 00:00:00 2001 From: Jarrett Gliner Date: Tue, 18 Apr 2017 19:30:57 -0700 Subject: [PATCH] Check for options change in ComponentWillReceiveProps --- lib/core.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/core.js b/lib/core.js index 1c1a4d7..f0b63c0 100644 --- a/lib/core.js +++ b/lib/core.js @@ -48,9 +48,10 @@ module.exports = { classData.componentWillReceiveProps = function(nextProps) { var chart = this.state.chart; + var optsChange = JSON.stringify(nextProps.options) !== JSON.stringify(this.props.options); - if (nextProps.redraw) { - chart.destroy(); // Reset the array of datasets + if (nextProps.redraw || optsChange) { + chart.destroy(); // Reset the array of datasets this.initializeChart(nextProps); } else { // assign all of the properites from the next datasets to the current chart