From 17cd6f0ae2169b8414a3b311a5fa2788f65250c2 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sun, 18 Jan 2026 03:09:57 -0600 Subject: [PATCH] fix(logic): context creation should NOT depend on autoplay setting CRITICAL LOGIC FIX: The autoplay setting was misunderstood. Corrected behavior: BEFORE (wrong): - Setting controls whether context is created - 'continue' = create context - 'track_only' = clear context AFTER (correct): - Context is ALWAYS created when playing from a source (album/playlist) - Stack icon ALWAYS appears - Setting only affects what happens at END of track: - 'continue' = play next track in context - 'track_only' = stop after current track Why this makes sense: - You're playing from an album = that's the context - Stack icon shows the origin (informative) - Setting controls continuation behavior (not context existence) Also: - Added logging to handleAutoplayModeChange - Will investigate why setting doesn't persist cp --- src/lib/components/views/SettingsView.svelte | 4 ++- src/routes/+page.svelte | 36 +++++++------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index e7058adda..e0eaecd85 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -1120,11 +1120,13 @@ } async function handleAutoplayModeChange(mode: AutoplayMode) { + console.log('[Settings] Changing autoplay mode to:', mode); try { await setAutoplayMode(mode); autoplayMode = mode; + console.log('[Settings] Autoplay mode saved successfully'); } catch (err) { - console.error('Failed to set autoplay mode:', err); + console.error('[Settings] Failed to set autoplay mode:', err); showToast('Failed to save autoplay preference', 'error'); } } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 4f2c58e49..20f4d12d6 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -598,32 +598,22 @@ async function handleAlbumTrackPlay(track: Track) { console.log('Playing album track:', track); - // Check autoplay preference and create/clear context - const prefs = getCachedPreferences(); - console.log('[Album] Autoplay preference:', prefs.autoplay_mode); - + // ALWAYS create context when playing from an album + // The setting only affects menu options visibility, not implicit behavior if (selectedAlbum?.tracks) { const trackIndex = selectedAlbum.tracks.findIndex(t => t.id === track.id); - console.log('[Album] Track index:', trackIndex, 'of', selectedAlbum.tracks.length); + const trackIds = selectedAlbum.tracks.map(t => t.id); - if (prefs.autoplay_mode === 'continue') { - // Create album context - const trackIds = selectedAlbum.tracks.map(t => t.id); - console.log('[Album] Creating context with', trackIds.length, 'tracks, starting at', trackIndex); - await setPlaybackContext( - 'album', - selectedAlbum.id, - selectedAlbum.title, - 'qobuz', - trackIds, - trackIndex >= 0 ? trackIndex : 0 - ); - console.log('[Album] Context created for continuous playback'); - } else { - // Clear context for single track playback - await clearPlaybackContext(); - console.log('[Album] Context cleared for single track playback'); - } + console.log('[Album] Creating context with', trackIds.length, 'tracks, starting at', trackIndex); + await setPlaybackContext( + 'album', + selectedAlbum.id, + selectedAlbum.title, + 'qobuz', + trackIds, + trackIndex >= 0 ? trackIndex : 0 + ); + console.log('[Album] Context created - stack icon should appear'); } else { console.log('[Album] No album tracks found, cannot create context'); }