()
| 922 | // Load the real library from /api/jobs (newest first). On success, seed the |
| 923 | // Mixer with the most recent track if nothing is selected yet. |
| 924 | async function loadLibrary() { |
| 925 | state.libState = "loading"; |
| 926 | render(); |
| 927 | try { |
| 928 | const jobs = await fetchJobs(); |
| 929 | state.tracks = jobs.map(jobToCard).sort((a, b) => b.createdAt - a.createdAt); |
| 930 | state.libState = state.tracks.length ? "ready" : "empty"; |
| 931 | } catch (e) { |
| 932 | console.warn("[mobile] failed to load library:", e); |
| 933 | state.libState = "error"; |
| 934 | } |
| 935 | render(); |
| 936 | } |
| 937 | |
| 938 | render(); |
| 939 | loadLibrary(); |
no test coverage detected