reactjs / react-chartjs

common react charting components using chart.js
MIT License
2.93k stars 301 forks source link

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

Closed erictse closed 9 years ago

erictse commented 9 years ago

Hi, this is a nifty module! Thanks for sharing.

I was trying to re-render my line chart by changing values in the parent component, so that the LineChart would recognize a prop update, but I discovered that it wouldn't re-render the chart using the new values. If I tried updating its props a second time, it would use the values from the first update.

I think initializeChart should use the props/nextProps argument instead of this.props because this.props gets gets updated after componentWillReceiveProps finishes. Let me know what you think.