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.
This commit is contained in:
Paulo Victor Cordeiro 2026-06-03 00:12:47 +01:00 committed by GitHub
parent dc3421c34e
commit bd0845e081
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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');