mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	fix: race conditions when when loading lots of videos quickly
This commit is contained in:
		
							parent
							
								
									a57448a411
								
							
						
					
					
						commit
						b009b2a87d
					
				
					 5 changed files with 11 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 -->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue