Event listener leak in ReorderableRow and ReorderableColumn #11357
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
ReorderableRow
andReorderableColumn
havebindEvents
andundbindEvents
methods. TheunbindEvents
forReorderableRow
is never called and the one forReorderanleColumn
is called in itsngOnDestroy
. Not calling the one for the row already seems like a bug to me, but the main problem is in the implementation of both the unbind methods. To illustrate this, a small excerpt from one of the bind functions:primeng/src/app/components/table/table.ts
Lines 3315 to 3316 in 3fe4a80
And the corresponding unbind:
primeng/src/app/components/table/table.ts
Lines 3333 to 3336 in 3fe4a80
As can be seen, the listeners are registered on the
nativeElement
but removed from thedocument
(where the listener was never registered), leaving the event listeners on the nativeElement behind. One could argue that, as the element is removed also the listeners get cleaned up, but this does not work for every usecase. Also, it seems that the idea was to have unbind methods, so let's make sure that they're correct and used :)As mentioned,
ReorderableColumn
does have anngOnDestroy
(see below) butReorderableRow
has not.primeng/src/app/components/table/table.ts
Lines 3393 to 3395 in 3fe4a80
The text was updated successfully, but these errors were encountered: