diff options
Diffstat (limited to 'client/src/app/core/routing/custom-reuse-strategy.ts')
-rw-r--r-- | client/src/app/core/routing/custom-reuse-strategy.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/app/core/routing/custom-reuse-strategy.ts b/client/src/app/core/routing/custom-reuse-strategy.ts index 5d3ad2e67..269b9d193 100644 --- a/client/src/app/core/routing/custom-reuse-strategy.ts +++ b/client/src/app/core/routing/custom-reuse-strategy.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { ComponentRef, Injectable } from '@angular/core' | 1 | import { ComponentRef, Injectable } from '@angular/core' |
2 | import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router' | 2 | import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router' |
3 | import { logger } from '@root-helpers/logger' | ||
3 | import { DisableForReuseHook } from './disable-for-reuse-hook' | 4 | import { DisableForReuseHook } from './disable-for-reuse-hook' |
4 | import { PeerTubeRouterService, RouterSetting } from './peertube-router.service' | 5 | import { PeerTubeRouterService, RouterSetting } from './peertube-router.service' |
5 | 6 | ||
@@ -22,7 +23,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy { | |||
22 | const key = this.generateKey(route) | 23 | const key = this.generateKey(route) |
23 | this.recentlyUsed = key | 24 | this.recentlyUsed = key |
24 | 25 | ||
25 | console.log('Storing component %s to reuse later.', key) | 26 | logger.info(`Storing component ${key} to reuse later.`) |
26 | 27 | ||
27 | const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook> | 28 | const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook> |
28 | componentRef.instance.disableForReuse() | 29 | componentRef.instance.disableForReuse() |
@@ -46,7 +47,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy { | |||
46 | const key = this.generateKey(route) | 47 | const key = this.generateKey(route) |
47 | this.recentlyUsed = key | 48 | this.recentlyUsed = key |
48 | 49 | ||
49 | console.log('Reusing component %s.', key) | 50 | logger.info(`Reusing component ${key}.`) |
50 | 51 | ||
51 | const handle = this.storedRouteHandles.get(key) | 52 | const handle = this.storedRouteHandles.get(key) |
52 | if (!handle) return handle; | 53 | if (!handle) return handle; |
@@ -66,7 +67,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy { | |||
66 | this.storedRouteHandles.forEach((r, key) => { | 67 | this.storedRouteHandles.forEach((r, key) => { |
67 | if (key === this.recentlyUsed) return | 68 | if (key === this.recentlyUsed) return |
68 | 69 | ||
69 | console.log('Removing stored component %s.', key); | 70 | logger.info(`Removing stored component ${key}`); |
70 | 71 | ||
71 | (r as any).componentRef.destroy() | 72 | (r as any).componentRef.destroy() |
72 | this.storedRouteHandles.delete(key) | 73 | this.storedRouteHandles.delete(key) |