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

fix(router): inside on push // SQUASH after review
This commit is contained in:
Victor Berchet
2017-05-17 17:47:34 -07:00
committed by Jason Aden
parent 81ca51a8f0
commit 5d4f5434fd
11 changed files with 351 additions and 235 deletions

View File

@ -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 */