From b51e5b74019bcd67d9adafd48c0cd79affe84892 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 8 Oct 2021 15:59:05 +0200 Subject: Correctly disable infinite scroll for reuse --- client/src/app/core/routing/custom-reuse-strategy.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'client/src/app/core') diff --git a/client/src/app/core/routing/custom-reuse-strategy.ts b/client/src/app/core/routing/custom-reuse-strategy.ts index 3000093a8..1498e221f 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 + componentRef.instance.disableForReuse() + componentRef.changeDetectorRef.detectChanges() this.storedRouteHandles.set(key, handle) -- cgit v1.2.3