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:
committed by
GitHub
parent
dc3421c34e
commit
bd0845e081
@@ -1721,7 +1721,7 @@ async function _loadEmails({ force = false, useCache = true } = {}) {
|
|||||||
async function _loadScheduled(grid, sp) {
|
async function _loadScheduled(grid, sp) {
|
||||||
const res = await fetch(`${API_BASE}/api/email/scheduled`);
|
const res = await fetch(`${API_BASE}/api/email/scheduled`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
sp.destroy();
|
if (sp) sp.destroy();
|
||||||
const items = data.scheduled || [];
|
const items = data.scheduled || [];
|
||||||
grid.innerHTML = '';
|
grid.innerHTML = '';
|
||||||
const stats = document.getElementById('email-lib-stats');
|
const stats = document.getElementById('email-lib-stats');
|
||||||
|
|||||||
Reference in New Issue
Block a user