From 6c73ebda08ddca53fcc2e6c36a034a338191cc56 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 7 Jan 2026 22:48:04 -0500 Subject: [PATCH] Ensure upload modal events rebind after reload --- js/ui/components/UploadModal.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/ui/components/UploadModal.js b/js/ui/components/UploadModal.js index 6cd56475..31590298 100644 --- a/js/ui/components/UploadModal.js +++ b/js/ui/components/UploadModal.js @@ -143,7 +143,11 @@ export class UploadModal { async load({ container } = {}) { if (this.root) { - return this.root; + if (this.root.isConnected) { + return this.root; + } + this.root = null; + this.eventsBound = false; } if (this.loadPromise) { @@ -192,8 +196,12 @@ export class UploadModal { throw new Error("Upload modal markup missing after load."); } + const previousRoot = this.root; this.container = targetContainer; this.root = modal; + if (previousRoot && previousRoot !== modal) { + this.eventsBound = false; + } this.cacheElements(modal); this.setupModalAccessibility();