Fix LocalLibrary not respecting 'Show in Local Library' setting

Problem: When user toggled the "Show Qobuz Downloads in Local Library"
setting in Settings, LocalLibraryView didn't refresh, so downloaded
tracks continued to appear even when the setting was disabled.

Root cause: LocalLibraryView only loaded data onMount and had no
mechanism to detect when download settings changed.

Solution:
- Created downloadSettingsStore with version tracking
- SettingsView notifies store when setting changes
- LocalLibraryView subscribes via $effect() and reloads data

Backend was already correctly filtering by the setting - this was
purely a frontend reactivity issue.

Files changed:
- src/lib/stores/downloadSettingsStore.ts (new)
- src/lib/components/views/SettingsView.svelte
- src/lib/components/views/LocalLibraryView.svelte
This commit is contained in:
vicrodh committed 2026-01-20 00:26:29 -06:00
1 parent 0d147a41b0
commit 51cfcd1c32
3 files changed
+32

No files matched your search

@@ -12,6 +12,7 @@
openDownloadCacheFolder,
type DownloadCacheStats
} from '$lib/stores/downloadState';
import { notifyDownloadSettingsChanged } from '$lib/stores/downloadSettingsStore';
import { clearCache as clearLyricsCache } from '$lib/stores/lyricsStore';
import {
getToastsEnabled,
@@ -631,6 +632,8 @@
try {
await invoke('set_show_downloads_in_library', { show: enabled });
showQobuzDownloadsInLibrary = enabled;
// Notify LocalLibraryView to refresh
notifyDownloadSettingsChanged();
} catch (e) {
console.error('Failed to update show downloads setting:', e);
}