amcharts3-react icon indicating copy to clipboard operation
amcharts3-react copied to clipboard

Checking if legend destroy exists before clearing a chart on unmount

Open shivangkumar opened this issue 6 years ago • 1 comments

When component unmounts before chart is completely rendered, in some race scenarios the legend object does not contain the destroy method and thus fails. This commit helps prevent the unmounting from breaking.

shivangkumar avatar Aug 15 '18 02:08 shivangkumar

@shivangkumar Thanks a lot for that!

However, I don't think it's quite correct. Charts aren't required to have a legend, and if they don't have a legend then your code will cause them to never be cleaned up, ever.

I'll need to discuss this with the team to figure out the best way to fix this.

Pauan avatar Aug 18 '18 11:08 Pauan