Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions src/renderer/views/Channel/Channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
</p>
</FtFlexBox>
<FtAutoLoadNextPageWrapper
v-if="showFetchMoreButton"
v-if="showFetchMoreButton && !isFetchMoreLoading"
@load-next-page="handleFetchMore"
>
<div
Expand Down Expand Up @@ -338,6 +338,7 @@ let mayContainContentFromOtherChannels = false
const isLoading = ref(true)
const isElementListLoading = ref(false)
const isSearchTabLoading = ref(false)
const isFetchMoreLoading = ref(false)
const currentTab = ref('videos')

const isCurrentTabLoading = computed(() => {
Expand Down Expand Up @@ -2225,74 +2226,80 @@ const showFetchMoreButton = computed(() => {
}
})

function handleFetchMore() {
async function handleFetchMore() {
if (isFetchMoreLoading.value) return

isFetchMoreLoading.value = true

switch (currentTab.value) {
case 'videos':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelVideosLocalMore()
await getChannelVideosLocalMore()
} else {
channelInvidiousVideos()
await channelInvidiousVideos()
}
break
case 'shorts':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelShortsLocalMore()
await getChannelShortsLocalMore()
} else {
channelInvidiousShorts()
await channelInvidiousShorts()
}
break
case 'live':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelLiveLocalMore()
await getChannelLiveLocalMore()
} else {
channelInvidiousLive()
await channelInvidiousLive()
}
break
case 'releases':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelReleasesLocalMore()
await getChannelReleasesLocalMore()
} else {
channelInvidiousReleasesMore()
await channelInvidiousReleasesMore()
}
break
case 'podcasts':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelPodcastsLocalMore()
await getChannelPodcastsLocalMore()
} else {
channelInvidiousPodcastsMore()
await channelInvidiousPodcastsMore()
}
break
case 'courses':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelCoursesLocalMore()
await getChannelCoursesLocalMore()
} else {
channelInvidiousCoursesMore()
await channelInvidiousCoursesMore()
}
break
case 'playlists':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getChannelPlaylistsLocalMore()
await getChannelPlaylistsLocalMore()
} else {
getPlaylistsInvidiousMore()
await getPlaylistsInvidiousMore()
}
break
case 'search':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
searchChannelLocal()
await searchChannelLocal()
} else {
searchChannelInvidious()
await searchChannelInvidious()
}
break
case 'community':
if (process.env.SUPPORTS_LOCAL_API && apiUsed === 'local') {
getCommunityPostsLocalMore()
await getCommunityPostsLocalMore()
} else {
getCommunityPostsInvidious()
await getCommunityPostsInvidious()
}
break
default:
console.error(currentTab.value)
}

isFetchMoreLoading.value = false
}

function changeTab(tab) {
Expand Down