Skip to content

Commit c7f139b

Browse files
committed
Fix shuffle splice and remove outdated todo comment
1 parent 4787e7f commit c7f139b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/renderer/components/WatchVideoPlaylist/WatchVideoPlaylist.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,6 @@ async function getPlaylistInformationInvidious() {
667667
getPlaylistInformationLocal()
668668
} else {
669669
isLoading.value = false
670-
// TODO: Show toast with error message
671670
}
672671
}
673672
}
@@ -694,10 +693,10 @@ function shufflePlaylistItems() {
694693
// Prevents the array from affecting the original object
695694
const items = playlistItems.value.slice()
696695
697-
let cachedCurrentVideo
696+
let cachedCurrentVideos
698697
699698
if (currentVideo.value != null) {
700-
cachedCurrentVideo = items.splice(currentVideoIndexZeroBased.value, 1)
699+
cachedCurrentVideos = items.splice(currentVideoIndexZeroBased.value, 1)
701700
// There is no else case
702701
// If current video is absent in (removed from) the playlist, nothing should be changed
703702
}
@@ -710,8 +709,8 @@ function shufflePlaylistItems() {
710709
items[j] = temp
711710
}
712711
713-
if (cachedCurrentVideo !== undefined) {
714-
items.unshift(cachedCurrentVideo)
712+
if (cachedCurrentVideos && cachedCurrentVideos.length > 0) {
713+
items.unshift(cachedCurrentVideos[0])
715714
}
716715
717716
randomizedPlaylistItems.value = items

0 commit comments

Comments
 (0)