fix priority queue reordering index recalculation

This commit is contained in:
jeffvli
2025-11-17 22:00:53 -08:00
parent 6890196274
commit 7f95ac3160
+12 -6
View File
@@ -802,7 +802,8 @@ export const usePlayerStoreBase = create<PlayerState>()(
(id) => !itemUniqueIds.includes(id),
);
recalculatePlayerIndex(state, newPriorityQueue);
const combinedQueue = [...newPriorityQueue, ...newDefaultQueue];
recalculatePlayerIndex(state, combinedQueue);
state.queue.priority = newPriorityQueue;
state.queue.default = newDefaultQueue;
@@ -835,7 +836,8 @@ export const usePlayerStoreBase = create<PlayerState>()(
(id) => !itemUniqueIds.includes(id),
);
recalculatePlayerIndex(state, newDefaultQueue);
const combinedQueue = [...newPriorityQueue, ...newDefaultQueue];
recalculatePlayerIndex(state, combinedQueue);
state.queue.default = newDefaultQueue;
state.queue.priority = newPriorityQueue;
@@ -866,7 +868,8 @@ export const usePlayerStoreBase = create<PlayerState>()(
const newDefaultQueue = [...filtered];
recalculatePlayerIndex(state, newPriorityQueue);
const combinedQueue = [...newPriorityQueue, ...newDefaultQueue];
recalculatePlayerIndex(state, combinedQueue);
state.queue.default = newDefaultQueue;
state.queue.priority = newPriorityQueue;
@@ -936,7 +939,8 @@ export const usePlayerStoreBase = create<PlayerState>()(
(id) => !uniqueIds.includes(id),
);
recalculatePlayerIndex(state, newPriorityQueue);
const combinedQueue = [...newPriorityQueue, ...newDefaultQueue];
recalculatePlayerIndex(state, combinedQueue);
state.queue.priority = newPriorityQueue;
state.queue.default = newDefaultQueue;
@@ -966,7 +970,8 @@ export const usePlayerStoreBase = create<PlayerState>()(
(id) => !uniqueIds.includes(id),
);
recalculatePlayerIndex(state, newDefaultQueue);
const combinedQueue = [...newPriorityQueue, ...newDefaultQueue];
recalculatePlayerIndex(state, combinedQueue);
state.queue.default = newDefaultQueue;
state.queue.priority = newPriorityQueue;
@@ -997,7 +1002,8 @@ export const usePlayerStoreBase = create<PlayerState>()(
const newDefaultQueue = [...filtered];
recalculatePlayerIndex(state, newPriorityQueue);
const combinedQueue = [...newPriorityQueue, ...newDefaultQueue];
recalculatePlayerIndex(state, combinedQueue);
state.queue.default = newDefaultQueue;
state.queue.priority = newPriorityQueue;