From 0b257753a6326c9ae5f5014925e9bb2fc404e68e Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 30 Jan 2026 13:33:40 +0100 Subject: [PATCH] fix(frontend): add imagePopups cleanup to cleanupAllFloatingWindows The imagePopups Map was not being cleaned up during SSE reconnects, causing memory leaks from orphaned drag event listeners on document. Co-Authored-By: Claude Opus 4.5 --- src/web/public/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/web/public/app.js b/src/web/public/app.js index a9d4c881..84dd6a39 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -11175,6 +11175,16 @@ class ClaudemanApp { this.planSubagents.clear(); } + // Clean up all image popup windows with their drag listeners + for (const [imageId, popupData] of this.imagePopups) { + if (popupData.dragListeners) { + document.removeEventListener('mousemove', popupData.dragListeners.move); + document.removeEventListener('mouseup', popupData.dragListeners.up); + } + popupData.element.remove(); + } + this.imagePopups.clear(); + // Clear orphaned plan generation state this.activePlanOrchestratorId = null; this._planProgressHandler = null;