react-bubble-chart icon indicating copy to clipboard operation
react-bubble-chart copied to clipboard

Undefined exception in componentWillUpdate()

Open ajmas opened this issue 8 years ago • 0 comments

When using a recent version of d3, I end up getting told that can not call update on undefined, in the componentWillUpdate() method. This is because it expects bubbleChart to have already been initialised in the componentDidMount() method.

I ask on StackOverflow and one response suggested:

here is the problem, component will mount will fire before mounting but your component will be rendered, possible multiple times, before is mounted, render and mounting are not the same, ie your component is inside of a container that is display: none. every time the property changes the component will be rendered but does not mean it will be mounted.

With that in mind, we should probably check that the bubbleChart is initialised in the componentWillUpdate() method?

ajmas avatar Jul 18 '17 20:07 ajmas