Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from erictse/master
Browse files Browse the repository at this point in the history
Potential bug fix with prop updates not rerendering with new data
  • Loading branch information
jhudson8 committed Jan 12, 2015
2 parents 42eed23 + ad79670 commit 554885a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ module.exports = {
chart.destroy();
};

classData.componentWillReceiveProps = function(props) {
classData.componentWillReceiveProps = function(nextProps) {
var chart = this.state.chart;
chart.destroy();
this.initializeChart(props);
this.initializeChart(nextProps);
};

classData.initializeChart = function(props) {
classData.initializeChart = function(nextProps) {
var el = this.getDOMNode();
var ctx = el.getContext("2d");
var chart = new Chart(ctx)[chartType](this.props.data, this.props.options || {});
var chart = new Chart(ctx)[chartType](nextProps.data, nextProps.options || {});
this.state.chart = chart;
};

Expand Down

0 comments on commit 554885a

Please sign in to comment.