From 35db6258ae73fcd6ec64acca26a9d8f4a722493b Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Thu, 11 Nov 2021 19:50:04 +0100 Subject: [PATCH] fix: duplicate video removal --- src/operations/ui/remove-videos-from-playlist.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/operations/ui/remove-videos-from-playlist.ts b/src/operations/ui/remove-videos-from-playlist.ts index 10b00e6..07a29af 100644 --- a/src/operations/ui/remove-videos-from-playlist.ts +++ b/src/operations/ui/remove-videos-from-playlist.ts @@ -26,9 +26,10 @@ export default function removeVideosFromPlaylist(videosToDelete: PlaylistVideo[] const playlistVideoRendererNodes = getElementsByXpath(XPATH.YT_PLAYLIST_VIDEO_RENDERERS) as any[] // All videos to remove MAY be present in the UI because if there is more videos to remove // than videos found into the UI, some removed videos aren't loaded in the UI + const uniqueVideosToDelete = [...new Map(videosToDelete.map((item) => [item.videoId, item])).values()] if (playlistVideoRendererNodes.length >= videosToDelete.length) { const searchMap = listMapSearch( - videosToDelete, + uniqueVideosToDelete, playlistVideoRendererNodes, (video) => video.videoId, (node) => node.data.videoId