fix queue add above current index in priority queue again

This commit is contained in:
jeffvli
2025-11-18 17:13:09 -08:00
parent ea82592f4b
commit 51e33d774a
+10
View File
@@ -417,6 +417,9 @@ export const usePlayerStoreBase = create<PlayerState>()(
state.queue.default = newQueue; state.queue.default = newQueue;
} else { } else {
const currentTrack = state.getCurrentSong() as QueueSong | undefined;
const currentTrackUniqueId = currentTrack?._uniqueId;
const priorityIndex = state.queue.priority.findIndex( const priorityIndex = state.queue.priority.findIndex(
(id) => id === uniqueId, (id) => id === uniqueId,
); );
@@ -451,6 +454,13 @@ export const usePlayerStoreBase = create<PlayerState>()(
} }
} }
const combinedQueue = [...state.queue.priority, ...state.queue.default];
recalculatePlayerIndexByUniqueId(
state,
currentTrackUniqueId,
combinedQueue,
);
if (state.player.shuffle === PlayerShuffle.TRACK) { if (state.player.shuffle === PlayerShuffle.TRACK) {
const currentIndex = state.player.index; const currentIndex = state.player.index;