diff --git a/app/components/internal/PlaylistSelect.vue b/app/components/internal/PlaylistSelect.vue index 8fed3fa..f911b81 100644 --- a/app/components/internal/PlaylistSelect.vue +++ b/app/components/internal/PlaylistSelect.vue @@ -14,6 +14,7 @@ import { usePlaylists } from '@/composeables/api/playlist-controller/playlist-co import { ChevronsUpDown, Music4, Plus } from 'lucide-vue-next'; import Button from '../ui/button/Button.vue'; import PlaylistCreateDialog from './playlists/select/PlaylistCreateDialog.vue'; +import { useCurrentPlaylistStore } from '~/stores/use-current-playlist-store'; const { open: sidebarOpen, @@ -21,18 +22,18 @@ const { const { isLoading, isError, error, data } = usePlaylists(); -const selectedPlaylist = ref(-1); +const currentPlaylistStore = useCurrentPlaylistStore(); watch(data, (value) => { - const newValue = value?.data[0]?.id || -1; - if (selectedPlaylist.value === -1) { - selectedPlaylist.value = newValue; + const newValue = value?.data[0]; + if (currentPlaylistStore.id === -1 && newValue) { + currentPlaylistStore.load(newValue); } });