From bd0845e0811c5b4131960031e4fa375a06f7c751 Mon Sep 17 00:00:00 2001 From: Paulo Victor Cordeiro <146781332+pvcordeiro@users.noreply.github.com> Date: Wed, 3 Jun 2026 00:12:47 +0100 Subject: [PATCH] fix: guard sp.destroy() in _loadScheduled against null spinner (#1495) When the scheduled folder is opened with cached data, sp is null (the loading spinner is skipped). _loadScheduled receives null and calls sp.destroy() unconditionally, crashing with TypeError. --- static/js/emailLibrary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js index 9cf38c1..a294ca0 100644 --- a/static/js/emailLibrary.js +++ b/static/js/emailLibrary.js @@ -1721,7 +1721,7 @@ async function _loadEmails({ force = false, useCache = true } = {}) { async function _loadScheduled(grid, sp) { const res = await fetch(`${API_BASE}/api/email/scheduled`); const data = await res.json(); - sp.destroy(); + if (sp) sp.destroy(); const items = data.scheduled || []; grid.innerHTML = ''; const stats = document.getElementById('email-lib-stats');