ngx-leaflet-draw icon indicating copy to clipboard operation
ngx-leaflet-draw copied to clipboard

Missing resources management

Open Azbesciak opened this issue 5 years ago • 1 comments

Hi, I noticed (because of the problems I have) that listeners on draw events are not released with ngOnDestroy. The question is - why? Is it because of performance reasons or does it seem to be unnecessary?

My scenario is that I have a single draw control for multiple groups of layers, one group active to edit/add at the time. I need to swich between them, and I came to an idea to reuse the single control (multiple events emitted, for each - I think it is better to have a single place where it is managed). But the problem is with those events, all the time new one is added, whereas the directive is still the same.

Azbesciak avatar Jun 30 '20 12:06 Azbesciak

I can try to fix this in a minor release. I agree we should be cleaning those up on destroy.

reblace avatar Aug 03 '20 21:08 reblace