import { ComponentRef, Injectable } from '@angular/core'
import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router'
+import { logger } from '@root-helpers/logger'
import { DisableForReuseHook } from './disable-for-reuse-hook'
import { PeerTubeRouterService, RouterSetting } from './peertube-router.service'
const key = this.generateKey(route)
this.recentlyUsed = key
- console.log('Storing component %s to reuse later.', key)
+ logger.info(`Storing component ${key} to reuse later.`)
const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook>
componentRef.instance.disableForReuse()
const key = this.generateKey(route)
this.recentlyUsed = key
- console.log('Reusing component %s.', key)
+ logger.info(`Reusing component ${key}.`)
const handle = this.storedRouteHandles.get(key)
if (!handle) return handle;
// Reuse the route if we're going to and from the same route
shouldReuseRoute (future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
- return future.routeConfig === curr.routeConfig
+ return future.routeConfig === curr.routeConfig && future.routeConfig?.data?.reloadOnSameNavigation !== true
}
private gb () {
this.storedRouteHandles.forEach((r, key) => {
if (key === this.recentlyUsed) return
- console.log('Removing stored component %s.', key);
+ logger.info(`Removing stored component ${key}`);
(r as any).componentRef.destroy()
this.storedRouteHandles.delete(key)