-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popover directive with delay can cause a memory leak #6709
Comments
Tooltip unsubscribe triggers on close trigger, could you please share reproduction or maybe you could use this event and avoid leaks. |
Issue is in Popover directive. My solution for now was using Tooltip directive instead, as it doesn't contain this issue, but I assume Popover should be fixed regardless. |
My mistake, Popover close trigger clears timer. |
The problem is with this subscription -
If component gets destroyed before reaching delay timeout and close trigger is somehow missed. |
Without a sample that would be hard to help you. |
Again, I don't need help here. |
In Tooltip directive there's
_delaySubscription
member, which is unsubscribed inngOnDestroy
method.However, in Popover directive there's
const _timer
which isn't being handled inngOnDestroy
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 directiveThe text was updated successfully, but these errors were encountered: