Skip to content

Commit

Permalink
Update to use local variable to potentially improve performance in no…
Browse files Browse the repository at this point in the history
…n-first load case
  • Loading branch information
kommunarr committed Dec 1, 2023
1 parent f010dcf commit 0ebb220
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ export default defineComponent({

this.isFamilyFriendly = result.basic_info.is_family_safe

this.recommendedVideos = result.watch_next_feed
const recommendedVideos = result.watch_next_feed
?.filter((item) => item.type === 'CompactVideo')
.map(parseLocalWatchNextVideo) ?? []

// place watched recommended videos last
this.recommendedVideos = [
...this.recommendedVideos.filter((video) => !this.isRecommendedVideoWatched(video.videoId)),
...this.recommendedVideos.filter((video) => this.isRecommendedVideoWatched(video.videoId))
...recommendedVideos.filter((video) => !this.isRecommendedVideoWatched(video.videoId)),
...recommendedVideos.filter((video) => this.isRecommendedVideoWatched(video.videoId))
]

if (this.showFamilyFriendlyOnly && !this.isFamilyFriendly) {
Expand Down Expand Up @@ -705,11 +705,11 @@ export default defineComponent({

this.videoPublished = result.published * 1000
this.videoDescriptionHtml = result.descriptionHtml
this.recommendedVideos = result.recommendedVideos
const recommendedVideos = result.recommendedVideos
// place watched recommended videos last
this.recommendedVideos = [
...this.recommendedVideos.filter((video) => !this.isRecommendedVideoWatched(video.videoId)),
...this.recommendedVideos.filter((video) => this.isRecommendedVideoWatched(video.videoId))
...recommendedVideos.filter((video) => !this.isRecommendedVideoWatched(video.videoId)),
...recommendedVideos.filter((video) => this.isRecommendedVideoWatched(video.videoId))
]
this.adaptiveFormats = await this.getAdaptiveFormatsInvidious(result)
this.isLive = result.liveNow
Expand Down

0 comments on commit 0ebb220

Please sign in to comment.