()
| 1706 | } |
| 1707 | |
| 1708 | async function syncWithServer() { |
| 1709 | try { |
| 1710 | const res = await fetch("/api/jobs", { cache: "no-store" }); |
| 1711 | if (!res.ok) return; |
| 1712 | const jobs = await res.json(); |
| 1713 | const trashIds = new Set(getTrashFolder()?.items || []); |
| 1714 | const deletedIds = getDeletedJobIds(); |
| 1715 | for (const state of jobs) { |
| 1716 | if (tracks[state.job_id]) continue; |
| 1717 | if (trashIds.has(state.job_id)) continue; // soft-deleted, skip |
| 1718 | if (deletedIds.has(state.job_id)) continue; // hard-deleted, skip |
| 1719 | const track = stateMetadataToTrack(state, { id: state.job_id, status: state.status }); |
| 1720 | track.id = state.job_id; |
| 1721 | addTrackToLibrary(track); |
| 1722 | } |
| 1723 | } catch (e) { console.warn("[catalog] failed to load jobs from backend:", e); } |
| 1724 | } |
| 1725 | |
| 1726 | // ─── Settings menu + Library editor ─── |
| 1727 |
no test coverage detected