benjeffery / react-plotlyjs

ReactJS / PlotlyJS integration. Draw plotly.js graphs in your react app.
MIT License
111 stars 29 forks source link

Don't try to remove cruft if null #5

Closed tht13 closed 8 years ago

tht13 commented 8 years ago

I have been getting a cannot get parent node of null error when unmounting the component. This PR will check if cruft is null before attempting to remove it.

n1mmy commented 8 years ago

I think this happens when you have two charts on a page and you unmount them both.

tht13 commented 8 years ago

Yes, that is correct But since react elements are not aware of other instances of themselves, I think this is the simplest way to fix the bug.

n1mmy commented 8 years ago

Yup! I was hit by the exact same issue. I applied this patch to my local fork and it worked like a charm. Thanks @tht13 !

@benjeffery would be great to have an official release with this patch. Running from a git fork is annoying because of the pre-compilation.

benjeffery commented 8 years ago

I'm on paternity leave currently - will try to find a moment to merge this in the next few days.

benjeffery commented 8 years ago

Released as v0.3.3. Thanks for reporting this. I'm still hoping for an upstream solution eventually!