Skip to content

Popover directive with delay can cause a memory leak #6709

@EvyatarBHA

Description

@EvyatarBHA

In Tooltip directive there's _delaySubscription member, which is unsubscribed in ngOnDestroy method.
However, in Popover directive there's const _timer which isn't being handled in ngOnDestroy method.
This can cause issues in case directive is being destroyed while subscription is active.
In our case, it happened when we used the Popover directive to show additional row details in an ag-grid cell renderer after hovering for 500ms, but it was destroyed when the grid was scrolled.

In addition, both directives contains an old and unused member _delayTimeoutId, which better be deleted regardless.

Versions of ngx-bootstrap, Angular, and Bootstrap:
ngx-bootstrap: 12.0.0 (but exists in latest code too)
Angular: 17.3.0
Bootstrap: 5.3.3

Expected behavior
Delay timer subscription should be unsubscribed if needed in ngOnDestroy method of Popover directive

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions