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

View File

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

View File

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

View File

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

View File

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