From ddc53ff1e0404b59d550f064fe34253f52a83f08 Mon Sep 17 00:00:00 2001 From: Chuck Date: Sat, 23 May 2026 12:29:34 -0400 Subject: [PATCH] fix(web-ui): guard setTimeout fallback for attachInstallButtonHandler The 500ms fallback setTimeout was calling attachInstallButtonHandler() unconditionally even when the plugins partial wasn't in the DOM, causing a spurious console.warn on every page load. Add the same element-existence check already present on the htmx:afterSettle listener. Co-Authored-By: Claude Sonnet 4.6 --- web_interface/static/v3/plugins_manager.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web_interface/static/v3/plugins_manager.js b/web_interface/static/v3/plugins_manager.js index 38bd89f4..65bab8ca 100644 --- a/web_interface/static/v3/plugins_manager.js +++ b/web_interface/static/v3/plugins_manager.js @@ -7473,13 +7473,14 @@ setTimeout(function() { console.log('installed-plugins-grid not found yet, will retry via event listeners'); } - // Also try to attach install button handler after a delay (fallback) + // Also try to attach install button handler after a delay (fallback). + // Only run if the install button element is already in the DOM (i.e. the + // plugins partial has been loaded); otherwise the htmx:afterSettle listener + // below handles it when the tab is first visited. setTimeout(() => { - if (typeof window.attachInstallButtonHandler === 'function') { - console.log('[FALLBACK] Attempting to attach install button handler...'); + if (typeof window.attachInstallButtonHandler === 'function' && + document.getElementById('install-plugin-from-url')) { window.attachInstallButtonHandler(); - } else { - console.warn('[FALLBACK] attachInstallButtonHandler not available on window'); } }, 500); }, 200);