mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
refactor: Update pending videos length calculation in Following, SubscribedSeries, and Trending pages
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user