-
-
Notifications
You must be signed in to change notification settings - Fork 102
perf: prevent leak of first DOM element that uses the mwlResizable directive #136
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
Conversation
Remove singleton pattern from PointerEventListeners. Each ResizableDirective now creates its own instance of PointerEventListeners instead of using a shared static instance. This prevents leaking of the the Renderer2 instance that the singleton holds onto when the DOM it's associated with is destroyed
Using the injected Renderer2 leaks a reference to the host element of the first ResizableDirective instance via the singleton PointerEventListeners
projects/angular-resizable-element/src/lib/resizable.directive.ts
Outdated
Show resolved
Hide resolved
projects/angular-resizable-element/src/lib/resizable.directive.ts
Outdated
Show resolved
Hide resolved
projects/angular-resizable-element/src/lib/resizable.directive.ts
Outdated
Show resolved
Hide resolved
projects/angular-resizable-element/src/lib/resizable.directive.ts
Outdated
Show resolved
Hide resolved
mattlewis92
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contribution!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #136 +/- ##
==========================================
+ Coverage 81.00% 81.13% +0.13%
==========================================
Files 5 5
Lines 279 281 +2
Branches 59 59
==========================================
+ Hits 226 228 +2
Misses 42 42
Partials 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Remove singleton pattern from PointerEventListeners.
Each ResizableDirective now creates its own instance of PointerEventListeners instead of using a shared static instance. This prevents leaking of the the Renderer2 instance that the singleton holds onto when the DOM it's associated with is destroyed