fix: clean up event listeners in OverlayComponent and SSModeComponent#763
Merged
EdwardMoyse merged 2 commits intoHSF:mainfrom Dec 24, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses memory leaks by implementing proper cleanup of event listeners in two Angular components when they are destroyed.
- Implemented
OnDestroylifecycle hook in bothOverlayComponentandSSModeComponent - Created bound handler references to enable proper event listener removal
- Added
ngOnDestroy()methods to clean up all registered event listeners
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
ss-mode.component.ts |
Added OnDestroy implementation to clean up fullscreenchange, click, and touchstart event listeners |
overlay.component.ts |
Added OnDestroy implementation with bound resize handler reference for proper window resize listener cleanup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...hoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/ss-mode/ss-mode.component.ts
Outdated
Show resolved
Hide resolved
- Add OnDestroy lifecycle hook to both components - Store resize handler reference for proper cleanup in OverlayComponent - Clear fullscreenchange and click/touchstart listeners in SSModeComponent Prevents memory leaks from accumulated event listeners during component lifecycle. Fixes HSF#762
621c4b2 to
54ba286
Compare
Collaborator
|
Limiting errors can be fixed with 'yarn lint:fix' |
Collaborator
|
Thank you very much for this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes memory leaks caused by event listeners not being cleaned up when Angular components are destroyed.
Closes #762
Problem
OverlayComponent
window.addEventListener('resize', ...)without cleanupSSModeComponent
document.onfullscreenchangenever clearedclick/touchstartlisteners persist after component destructionSolution
OnDestroylifecycle hook in both componentsngOnDestroy()to remove all event listenersTesting