From 66094283c95c593cd83e264cb05d0ae2be4f4bc5 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Mon, 1 Nov 2021 03:21:15 -0700 Subject: [PATCH] Fix move to bottom using index on context menu --- src/components/shared/ContextMenu.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/shared/ContextMenu.tsx b/src/components/shared/ContextMenu.tsx index d74bc17..1627c3b 100644 --- a/src/components/shared/ContextMenu.tsx +++ b/src/components/shared/ContextMenu.tsx @@ -439,10 +439,17 @@ export const GlobalContextMenu = () => { const handleMoveSelectedToIndex = () => { if (misc.contextMenu.type === 'nowPlaying') { const currentEntryList = getCurrentEntryList(playQueue); - const uniqueIdOfIndexToMoveTo = playQueue[currentEntryList][indexToMoveTo].uniqueId; - dispatch( - moveToIndex({ entries: multiSelect.selected, moveBeforeId: uniqueIdOfIndexToMoveTo }) - ); + + if (Number(indexToMoveTo) === playQueue[currentEntryList].length) { + dispatch(moveToBottom({ selectedEntries: multiSelect.selected })); + } else { + const uniqueIdOfIndexToMoveTo = playQueue[currentEntryList][indexToMoveTo].uniqueId; + dispatch( + moveToIndex({ entries: multiSelect.selected, moveBeforeId: uniqueIdOfIndexToMoveTo }) + ); + } + } else if (Number(indexToMoveTo) === playlist.entry.length) { + dispatch(plMoveToBottom({ selectedEntries: multiSelect.selected })); } else { const uniqueIdOfIndexToMoveTo = playlist.entry[indexToMoveTo].uniqueId; dispatch(