Skip to content

Event listener clean up#1224

Merged
cyanzhong merged 1 commit intomainfrom
develop
Jan 30, 2026
Merged

Event listener clean up#1224
cyanzhong merged 1 commit intomainfrom
develop

Conversation

@cyanzhong
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses event listener memory leaks by implementing proper cleanup strategies for event handlers. The changes prevent duplicate event listener registrations that would occur when the editor is reset multiple times.

Changes:

  • Implemented cleanup logic for gutter hover effect event listeners to prevent duplicates when line numbers are toggled
  • Moved window and viewport resize event listeners from resetEditor() to module level to prevent duplicate registrations on editor resets

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
CoreEditor/src/styling/config.ts Added storage for event handlers and cleanup logic to remove old gutter listeners before attaching new ones
CoreEditor/src/core.ts Relocated window resize and visualViewport listeners to module level, fixing memory leak from duplicate registrations in resetEditor()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cyanzhong cyanzhong merged commit 477ee22 into main Jan 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant