From 3613dd5fdba5507ee4761182a49b8556958ea58d Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Tue, 20 Jan 2026 09:21:38 -0600 Subject: [PATCH] Fix create new playlist option conflicting with pending playlist IDs - Use CREATE_NEW_PLAYLIST (-999999) instead of -1 - Prevents conflict with negative pending playlist IDs (-1, -2, etc.) - Fixes add to playlist showing name input when selecting existing pending playlist --- src/lib/components/PlaylistModal.svelte | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/components/PlaylistModal.svelte b/src/lib/components/PlaylistModal.svelte index 30da227a1..e0057b983 100644 --- a/src/lib/components/PlaylistModal.svelte +++ b/src/lib/components/PlaylistModal.svelte @@ -46,6 +46,9 @@ let loading = $state(false); let error = $state(null); + // Special value for "create new playlist" option (won't collide with negative pending playlist IDs) + const CREATE_NEW_PLAYLIST = -999999; + // Local track counts for playlists let localTrackCounts = $state>(new Map()); let showDeleteConfirm = $state(false); @@ -314,7 +317,7 @@ } else if (mode === 'edit') { handleUpdate(); } else if (mode === 'addTrack') { - if (selectedPlaylistId === -1) { + if (selectedPlaylistId === CREATE_NEW_PLAYLIST) { // Create new playlist option selected handleCreateAndAdd(); } else { @@ -375,14 +378,14 @@ disabled={loading} > - + {#each userPlaylists as pl (pl.id)} {/each} - {#if selectedPlaylistId === -1} + {#if selectedPlaylistId === CREATE_NEW_PLAYLIST}