[bugfix]: improve play behavior

- when adding songs to queue, only `play()` if the queue was empty
- when adding next/last to empty queue, behavior should be same as now
This commit is contained in:
Kendall Garner 2024-02-10 00:38:21 -08:00
parent 0a658e3a22
commit ae8fc6df13
No known key found for this signature in database
GPG key ID: 18D2767419676C87
2 changed files with 9 additions and 3 deletions

View file

@ -167,6 +167,7 @@ export const useHandlePlayQueueAdd = () => {
initialSongIndex = songs.findIndex((song) => song.id === initialSongId);
}
const hadSong = usePlayerStore.getState().queue.default.length > 0;
const playerData = addToQueue({ initialIndex: initialSongIndex, playType, songs });
if (playerType === PlaybackType.LOCAL) {
@ -183,7 +184,11 @@ export const useHandlePlayQueueAdd = () => {
}
}
play();
// We should only play if the queue was empty, or we are doing play NOW
// (override the queue).
if (playType === Play.NOW || !hadSong) {
play();
}
remote?.updateSong({
currentTime: usePlayerStore.getState().current.time,