refactor(router): don't run the change detection every time an outlet is activated
This commit is contained in:

committed by
Matias Niemelä

parent
44d48d9d7a
commit
198edb3109
@ -8,6 +8,7 @@
|
||||
|
||||
import {ComponentRef} from '@angular/core';
|
||||
|
||||
import {OutletContext} from './router_outlet_context';
|
||||
import {ActivatedRoute, ActivatedRouteSnapshot} from './router_state';
|
||||
import {TreeNode} from './utils/tree';
|
||||
|
||||
@ -23,6 +24,7 @@ export type DetachedRouteHandle = {};
|
||||
|
||||
/** @internal */
|
||||
export type DetachedRouteHandleInternal = {
|
||||
contexts: Map<string, OutletContext>,
|
||||
componentRef: ComponentRef<any>,
|
||||
route: TreeNode<ActivatedRoute>,
|
||||
};
|
||||
@ -36,7 +38,11 @@ export abstract class RouteReuseStrategy {
|
||||
/** Determines if this route (and its subtree) should be detached to be reused later */
|
||||
abstract shouldDetach(route: ActivatedRouteSnapshot): boolean;
|
||||
|
||||
/** Stores the detached route */
|
||||
/**
|
||||
* Stores the detached route.
|
||||
*
|
||||
* Storing a `null` value should erase the previously stored value.
|
||||
*/
|
||||
abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle|null): void;
|
||||
|
||||
/** Determines if this route (and its subtree) should be reattached */
|
||||
|
Reference in New Issue
Block a user