MCPcopy
hub / github.com/stemdeckapp/stemdeck / syncWithServer

Function syncWithServer

static/js/catalog.js:1708–1724  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1706}
1707
1708async 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

Callers 2

resyncLibraryFunction · 0.85
initCatalogFunction · 0.85

Calls 4

getTrashFolderFunction · 0.85
getDeletedJobIdsFunction · 0.85
stateMetadataToTrackFunction · 0.85
addTrackToLibraryFunction · 0.85

Tested by

no test coverage detected