From f3a397fc74183488dde6959ace058c912ead40a9 Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Wed, 25 Feb 2026 16:54:50 -0800 Subject: [PATCH] Chain Jellyfin loads Ensure Jellyfin music libraries are loaded after users by chaining loadJellyfinUsers() with .then(loadJellyfinMusicLibraries()) at three call sites (settings load, server toggle, and connection test) to avoid race conditions. Also add database write-ahead log and shared-memory files (database/music_library.db-wal and database/music_library.db-shm). --- webui/static/script.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/webui/static/script.js b/webui/static/script.js index 9b1f9cc9..b26d43b8 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -1804,8 +1804,7 @@ async function loadSettingsData() { // Load Jellyfin users and music libraries if Jellyfin is the active server if (activeServer === 'jellyfin') { - loadJellyfinUsers(); - loadJellyfinMusicLibraries(); + loadJellyfinUsers().then(() => loadJellyfinMusicLibraries()); } // Populate Soulseek settings @@ -1965,8 +1964,7 @@ function toggleServer(serverType) { // Load Jellyfin users and music libraries when switching to Jellyfin if (serverType === 'jellyfin') { - loadJellyfinUsers(); - loadJellyfinMusicLibraries(); + loadJellyfinUsers().then(() => loadJellyfinMusicLibraries()); } // Auto-save after server toggle change @@ -2588,8 +2586,7 @@ async function testConnection(service) { if (service === 'plex') { loadPlexMusicLibraries(); } else if (service === 'jellyfin') { - loadJellyfinUsers(); - loadJellyfinMusicLibraries(); + loadJellyfinUsers().then(() => loadJellyfinMusicLibraries()); } } else { showToast(`${service} connection failed: ${result.error}`, 'error');