diff --git a/templates/partials/slm_settings_modal.html b/templates/partials/slm_settings_modal.html index 02e9ac6..0b89025 100644 --- a/templates/partials/slm_settings_modal.html +++ b/templates/partials/slm_settings_modal.html @@ -528,7 +528,7 @@ async function saveSLMSettings(event) { if (typeof checkFTPStatus === 'function') { checkFTPStatus(unitId); } - if (typeof htmx !== 'undefined') { + if (typeof htmx !== 'undefined' && document.getElementById('slm-list')) { htmx.trigger('#slm-list', 'load'); } }, 1500); @@ -604,8 +604,10 @@ async function toggleSLMDeployed() { successDiv.classList.remove('hidden'); setTimeout(() => successDiv.classList.add('hidden'), 3000); - // Refresh any SLM list on the page - if (typeof htmx !== 'undefined') { + // Refresh any SLM list on the page (only if one is actually present — + // the detail/dashboard pages have no #slm-list, and htmx.trigger on a + // null target throws "can't access property dispatchEvent, e is null"). + if (typeof htmx !== 'undefined' && document.getElementById('slm-list')) { htmx.trigger('#slm-list', 'load'); } } catch (error) {