cache spotify playlists
This commit is contained in:
parent
8cee3f0e33
commit
429622610e
1 changed files with 5 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ let dbUpdateStatusInterval = null;
|
||||||
let spotifyPlaylists = [];
|
let spotifyPlaylists = [];
|
||||||
let selectedPlaylists = new Set();
|
let selectedPlaylists = new Set();
|
||||||
let activeSyncPollers = {}; // Key: playlist_id, Value: intervalId
|
let activeSyncPollers = {}; // Key: playlist_id, Value: intervalId
|
||||||
|
let spotifyPlaylistsLoaded = false;
|
||||||
|
|
||||||
// API endpoints
|
// API endpoints
|
||||||
const API = {
|
const API = {
|
||||||
|
|
@ -1405,7 +1406,9 @@ async function loadDashboardData() {
|
||||||
|
|
||||||
async function loadSyncData() {
|
async function loadSyncData() {
|
||||||
// This is called when the sync page is navigated to.
|
// This is called when the sync page is navigated to.
|
||||||
await loadSpotifyPlaylists();
|
if (!spotifyPlaylistsLoaded) {
|
||||||
|
await loadSpotifyPlaylists();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadSpotifyPlaylists() {
|
async function loadSpotifyPlaylists() {
|
||||||
|
|
@ -1424,6 +1427,7 @@ async function loadSpotifyPlaylists() {
|
||||||
}
|
}
|
||||||
spotifyPlaylists = await response.json();
|
spotifyPlaylists = await response.json();
|
||||||
renderSpotifyPlaylists();
|
renderSpotifyPlaylists();
|
||||||
|
spotifyPlaylistsLoaded = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
container.innerHTML = `<div class="playlist-placeholder">❌ Error: ${error.message}</div>`;
|
container.innerHTML = `<div class="playlist-placeholder">❌ Error: ${error.message}</div>`;
|
||||||
showToast(`Error loading playlists: ${error.message}`, 'error');
|
showToast(`Error loading playlists: ${error.message}`, 'error');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue