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

Potential bug fix with prop updates not rerendering with new data #1

Merged
merged 1 commit into from
Jan 12, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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