-
Notifications
You must be signed in to change notification settings - Fork 5
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
When an SVG element is being detached, remove its events #521
Comments
Could we remove the event handler in onDestroy? |
We could but as I understand it, it wouldn't be as comprehensive as the method I gave. Consider if view is set(SVG element A), then unset and set again(SVG element B). Using onDestroy, events will be detached from B but not A. |
I'm not sure that its possible to unset without destroying the component |
If you assign 0,0 to view (or later set view to null), I thought the elements in the ngIf are removed from the DOM - this includes the SVG element. If inconclusive we could test it. |
Good point. I guess once we start using the view selectors, this should prevent the svg from getting removed. |
I think we might still need the ngIf, as the view has not yet been populated via the ResizeObserver when the app first starts up. |
In
NgxD3timelineComponent
, the setter of svgElement attaches events to the SVG when the SVG element itself is attached to the DOM.We likely should also detach the events in the case where the SVG element is removed or changed. This can be achieved by:
The text was updated successfully, but these errors were encountered: