ng2-dragula icon indicating copy to clipboard operation
ng2-dragula copied to clipboard

Memory leak via drake events not being unsubscribed

Open maximcoding opened this issue 5 years ago • 1 comments

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:

  1. add drake.on('remove') in the Component
  2. Open component few times .
  3. Take memory snapshot in chrome .
  4. See few instances of your Component . Screen Shot 2019-07-11 at 17 47 25

maximcoding avatar Jul 11 '19 14:07 maximcoding

Not a documentation issue. This is a regular bug that should be fixed. Thanks.

cormacrelf avatar Aug 22 '19 00:08 cormacrelf