Merge pull request #3674 from Bnyro/master

fix: race conditions when when loading lots of videos quickly
This commit is contained in:
Bnyro 2024-06-15 14:18:19 +02:00 committed by GitHub
commit 0a95270461
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 13 deletions

View File

@ -183,8 +183,8 @@ export default {
this.channel.nextpage = json.nextpage;
this.loading = false;
this.updateWatched(json.relatedStreams);
json.relatedStreams.map(stream => this.contentItems.push(stream));
this.fetchDeArrowContent(this.contentItems);
this.contentItems.push(...json.relatedStreams);
this.fetchDeArrowContent(json.relatedStreams);
});
},
fetchChannelTabNextPage() {
@ -194,8 +194,8 @@ export default {
}).then(json => {
this.tabs[this.selectedTab].tabNextPage = json.nextpage;
this.loading = false;
json.content.map(item => this.contentItems.push(item));
this.fetchDeArrowContent(this.contentItems);
json.this.contentItems.push(...json.content);
this.fetchDeArrowContent(json.content);
this.tabs[this.selectedTab].content = this.contentItems;
});
},
@ -246,7 +246,7 @@ export default {
data: this.tabs[index].data,
}).then(tab => {
this.contentItems = this.tabs[index].content = tab.content;
this.fetchDeArrowContent(this.contentItems);
this.fetchDeArrowContent(tab.content);
this.tabs[this.selectedTab].tabNextPage = tab.nextpage;
});
},

View File

@ -1,5 +1,5 @@
<template v-if="text">
<div class="mx-1 whitespace-pre-wrap py-2">
<template>
<div v-if="text" class="mx-1 whitespace-pre-wrap py-2">
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-if="showFullText" class="contentText" v-html="fullText()" />
<!-- eslint-disable-next-line vue/no-v-html -->

View File

@ -131,8 +131,8 @@ export default {
if (!this.videosStore) return;
this.currentVideoCount = Math.min(this.currentVideoCount + this.videoStep, this.videosStore.length);
if (this.videos.length != this.videosStore.length) {
this.fetchDeArrowContent(this.videosStore.slice(this.videos.length, this.currentVideoCount));
this.videos = this.videosStore.slice(0, this.currentVideoCount);
this.fetchDeArrowContent(this.videos);
}
},
handleScroll() {

View File

@ -525,9 +525,7 @@ export default {
}
}
});
await this.fetchPlaylistPages().then(() => {
this.fetchDeArrowContent(this.playlist.relatedStreams);
});
await this.fetchPlaylistPages();
}
},
async fetchPlaylistPages() {
@ -535,8 +533,9 @@ export default {
await this.fetchJson(this.apiUrl() + "/nextpage/playlists/" + this.playlistId, {
nextpage: this.playlist.nextpage,
}).then(json => {
this.playlist.relatedStreams = this.playlist.relatedStreams.concat(json.relatedStreams);
this.playlist.relatedStreams.push(...json.relatedStreams);
this.playlist.nextpage = json.nextpage;
this.fetchDeArrowContent(json.relatedStreams);
});
await this.fetchPlaylistPages();
}

View File

@ -524,7 +524,6 @@ const mixin = {
const videoIds = content
.filter(item => item.type === "stream")
.filter(item => item.dearrow === undefined)
.map(item => item.url.substr(-11))
.sort();