diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index 05f6874..cd4f065 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -1182,7 +1182,7 @@ const externalAvail = p.externalAvailable || 0; return ` - + ${escapeHtml(p.name)} ${localCount} ${externalCount > 0 ? `${externalAvail}/${externalCount}` : '-'} @@ -1246,9 +1246,22 @@ showToast('Playlist linked!', 'success'); showRestartBanner(); closeModal('link-playlist-modal'); - // Refresh both tabs to show updated status - fetchJellyfinPlaylists(); - fetchPlaylists(); + + // Update UI state without refetching all playlists + const playlistsTable = document.getElementById('jellyfinPlaylistsTable'); + if (playlistsTable) { + const rows = playlistsTable.querySelectorAll('tr'); + rows.forEach(row => { + if (row.dataset.playlistId === jellyfinId) { + const actionCell = row.querySelector('td:last-child'); + if (actionCell) { + actionCell.innerHTML = ``; + } + } + }); + } + + fetchPlaylists(); // Only refresh the Active Playlists tab } else { showToast(data.error || 'Failed to link playlist', 'error'); } @@ -1270,8 +1283,24 @@ if (res.ok) { showToast('Playlist unlinked.', 'success'); showRestartBanner(); - fetchJellyfinPlaylists(); - fetchPlaylists(); + + // Update UI state without refetching all playlists + const playlistsTable = document.getElementById('jellyfinPlaylistsTable'); + if (playlistsTable) { + const rows = playlistsTable.querySelectorAll('tr'); + rows.forEach(row => { + const nameCell = row.querySelector('td:first-child'); + if (nameCell && nameCell.textContent === name) { + const actionCell = row.querySelector('td:last-child'); + if (actionCell) { + const playlistId = row.dataset.playlistId; + actionCell.innerHTML = ``; + } + } + }); + } + + fetchPlaylists(); // Only refresh the Active Playlists tab } else { showToast(data.error || 'Failed to unlink playlist', 'error'); }