fix(favorites): add debug logging for preferences loading

cp
This commit is contained in:
vicrodh committed 2026-01-18 16:21:36 -06:00
1 parent e752791d3a
commit 9c45a82fd8
1 file changed
+17
@@ -324,6 +324,7 @@
async function loadFavoritesPreferences() {
try {
const prefs = await invoke<FavoritesPreferences>('get_favorites_preferences');
console.log('[FavoritesView] Loaded preferences:', prefs);
favoritesPreferences = prefs;
} catch (err) {
console.error('Failed to load favorites preferences:', err);
@@ -348,6 +349,22 @@
}
});
// Sync activeTab when navigating back/forward
$effect(() => {
if (!isInitialMount && currentTab && currentTab !== activeTab) {
activeTab = currentTab;
if (activeTab === 'tracks' && favoriteTracks.length === 0) {
loadFavorites(activeTab);
} else if (activeTab === 'albums' && favoriteAlbums.length === 0) {
loadFavorites(activeTab);
} else if (activeTab === 'artists' && favoriteArtists.length === 0) {
loadFavorites(activeTab);
} else if (activeTab === 'playlists' && favoritePlaylists.length === 0) {
loadFavorites(activeTab);
}
}
});
const FAVORITES_PAGE_SIZE = 200;
const FAVORITES_MAX_PAGES = 50;