refactor: Update pending videos length calculation in Following, SubscribedSeries, and Trending pages

This commit is contained in:
Hakadao
2024-05-27 10:50:48 +08:00
parent 8967dd51df
commit 7094547f01
3 changed files with 3 additions and 9 deletions

View File

@@ -107,9 +107,7 @@ async function getFollowedUsersVideos() {
try {
let i = 0
// https://github.com/starknt/BewlyBewly/blob/fad999c2e482095dc3840bb291af53d15ff44130/src/contentScripts/views/Home/components/ForYou.vue#L208
// When video list is not empty, addthe number of pending videos is half of the page size
// is set to prevent user scrolling the page too fast and causing the page too laggy
const pendingVideos: VideoElement[] = Array.from({ length: videoList.value.length ? 10 : 30 }, () => ({
const pendingVideos: VideoElement[] = Array.from({ length: 30 }, () => ({
uniqueId: `unique-id-${(videoList.value.length || 0) + i++})}`,
} satisfies VideoElement))
let lastVideoListLength = videoList.value.length

View File

@@ -111,9 +111,7 @@ async function getFollowedUsersVideos() {
try {
let i = 0
// https://github.com/starknt/BewlyBewly/blob/fad999c2e482095dc3840bb291af53d15ff44130/src/contentScripts/views/Home/components/ForYou.vue#L208
// When video list is not empty, addthe number of pending videos is half of the page size
// is set to prevent user scrolling the page too fast and causing the page too laggy
const pendingVideos: VideoElement[] = Array.from({ length: videoList.value.length ? 10 : 30 }, () => ({
const pendingVideos: VideoElement[] = Array.from({ length: 30 }, () => ({
uniqueId: `unique-id-${(videoList.value.length || 0) + i++})}`,
} satisfies VideoElement))
let lastVideoListLength = videoList.value.length

View File

@@ -77,9 +77,7 @@ async function getTrendingVideos() {
try {
let i = 0
// https://github.com/starknt/BewlyBewly/blob/fad999c2e482095dc3840bb291af53d15ff44130/src/contentScripts/views/Home/components/ForYou.vue#L208
// When video list is not empty, addthe number of pending videos is half of the page size
// is set to prevent user scrolling the page too fast and causing the page too laggy
const pendingVideos: VideoElement[] = Array.from({ length: videoList.value.length ? 10 : 30 }, () => ({
const pendingVideos: VideoElement[] = Array.from({ length: 30 }, () => ({
uniqueId: `unique-id-${(videoList.value.length || 0) + i++})}`,
} satisfies VideoElement))
let lastVideoListLength = videoList.value.length