ActivityPub-federated video streaming platform using P2P directly in your web browser
Correctly disable infinite scroll for reuse
Chocobozzz0af2a8c5d62b
diff --git a/client/src/app/core/routing/custom-reuse-strategy.ts b/client/src/app/core/routing/custom-reuse-strategy.tsindex 3000093a8d..1498e221fb 100644--- a/client/src/app/core/routing/custom-reuse-strategy.ts+++ b/client/src/app/core/routing/custom-reuse-strategy.ts@@ -1,7 +1,7 @@-import { Injectable } from '@angular/core'+import { ComponentRef, Injectable } from '@angular/core'import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router'-import { RouterSetting } from './'-import { PeerTubeRouterService } from './peertube-router.service'+import { DisableForReuseHook } from './disable-for-reuse-hook'+import { PeerTubeRouterService, RouterSetting } from './peertube-router.service'@Injectable()export class CustomReuseStrategy implements RouteReuseStrategy {@@ -22,9 +22,11 @@ export class CustomReuseStrategy implements RouteReuseStrategy {const key = this.generateKey(route)this.recentlyUsed = key- console.log('Storing component %s to reuse later.', key);+ console.log('Storing component %s to reuse later.', key)- (handle as any).componentRef.instance.disableForReuse()+ const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook>+ componentRef.instance.disableForReuse()+ componentRef.changeDetectorRef.detectChanges()this.storedRouteHandles.set(key, handle)diff --git a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.tsindex bebc6efa7d..c247cfde2d 100644--- a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts+++ b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts@@ -13,6 +13,7 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterViewCh// Add angular state in query params to reuse the routed component@Input() setAngularState: boolean+ @Input() parentDisabled = false@Output() nearOfBottom = new EventEmitter<void>()@@ -74,7 +75,7 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterViewChfilter(({ current, maximumScroll }) => (current / maximumScroll) > this.decimalLimit)).subscribe(() => {- if (this.setAngularState) this.setScrollRouteParams()+ if (this.setAngularState && !this.parentDisabled) this.setScrollRouteParams()this.nearOfBottom.emit()})diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.html b/client/src/app/shared/shared-video-miniature/videos-list.component.htmlindex 67933f1777..2b554517f7 100644--- a/client/src/app/shared/shared-video-miniature/videos-list.component.html+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.html@@ -40,7 +40,8 @@<div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos.length === 0">No results.</div><div- myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()" [setAngularState]="true"+ myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"+ [setAngularState]="true" [parentDisabled]="disabled"class="videos" [ngClass]="{ 'display-as-row': displayAsRow }"><ng-container *ngFor="let video of videos; trackBy: videoById;">diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.html b/client/src/app/shared/shared-video-miniature/videos-selection.component.htmlindex f2af874dde..6ea2661e4d 100644--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.html+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.html@@ -2,7 +2,8 @@<divclass="videos"- myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()" [setAngularState]="true"+ myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"+ [parentDisabled]="disabled" [setAngularState]="true"><div class="video" *ngFor="let video of videos; let i = index; trackBy: videoById">