Skip to content

Fix memory leak in Resizer.svelte event listeners#4

Closed
Copilot wants to merge 3 commits intolayout-management-changefrom
copilot/sub-pr-1-another-one
Closed

Fix memory leak in Resizer.svelte event listeners#4
Copilot wants to merge 3 commits intolayout-management-changefrom
copilot/sub-pr-1-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 4, 2025

Event listeners added to document during mouse/touch drag operations in Resizer.svelte were never cleaned up if the component unmounted mid-drag, causing memory leaks.

Changes

  • Add onDestroy lifecycle hook to remove document-level event listeners on unmount
  • Clean up both mouse (mousemove, mouseup) and touch (touchmove, touchend) listeners
  • Reset body styles (cursor, userSelect) if unmounting during active drag
onDestroy(() => {
    document.removeEventListener("mousemove", handleMouseMove);
    document.removeEventListener("mouseup", handleMouseUp);
    document.removeEventListener("touchmove", handleTouchMove);
    document.removeEventListener("touchend", handleTouchEnd);
    if (isDragging) {
        document.body.style.cursor = "";
        document.body.style.userSelect = "";
    }
});

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 4, 2025 02:18
… in Resizer.svelte

Co-authored-by: devnull03 <56480041+devnull03@users.noreply.github.com>
Co-authored-by: devnull03 <56480041+devnull03@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on layout management changes Fix memory leak in Resizer.svelte event listeners Dec 4, 2025
Copilot AI requested a review from devnull03 December 4, 2025 02:21
@devnull03 devnull03 closed this Dec 4, 2025
@devnull03 devnull03 deleted the copilot/sub-pr-1-another-one branch December 4, 2025 13:18
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.

2 participants