ng2-dragula
ng2-dragula copied to clipboard
Memory leak via drake events not being unsubscribed
Please add documentation to prevent memory leak (Angular 7 Component never destroyed thats listens to drake events like drake.on('cancel') , drake.on('drop') and etc.. ) . Using version ng2-dragula: "1.5.0" - and can't upgrade ( in new version of Dragula implementation has been changed ) and should be done hard refactor to my project . Fixed the problem with :
ngOnDestroy(): void {
this.drake.off('over');
this.drake.off('out');
this.drake.off('drag');
this.drake.off('drop');
this.drake.off('remove');
this.drake.off('cancel');
}
}
How to reproduce the memory leak:
- add drake.on('remove') in the Component
- Open component few times .
- Take memory snapshot in chrome .
- See few instances of your Component .
Not a documentation issue. This is a regular bug that should be fixed. Thanks.