bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
928 stars 330 forks source link

Cannot read properties of null (reading 'getBoundingClientRect') #258

Closed kodelio closed 1 year ago

kodelio commented 1 year ago

I have place the chart into a Vue component. When I destroy the component (navigating to another page) and I resize the page, I get the error : Cannot read properties of null (reading 'getBoundingClientRect')

CleanShot 2023-03-15 at 11 40 15@2x

Because the resize event still exists on the window element.

How could I remove the event when my component is destroyed ?

bumbeishvili commented 1 year ago

If you have the possibility to catch that moment, I'd write

d3.select(window).on('resize.'+chart.id(), null)
kodelio commented 1 year ago

Thanks ! It's working

CleanShot 2023-03-15 at 11 56 49