@@ -30,11 +30,11 @@ import {RouterOutlet} from './directives/router_outlet';
|
||||
import {recognize} from './recognize';
|
||||
import {LoadedRouterConfig, RouterConfigLoader} from './router_config_loader';
|
||||
import {RouterOutletMap} from './router_outlet_map';
|
||||
import {ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot, advanceActivatedRoute, createEmptyState, inheritedParamsDataResolve} from './router_state';
|
||||
import {ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot, advanceActivatedRoute, createEmptyState, equalParamsAndUrlSegments, inheritedParamsDataResolve} from './router_state';
|
||||
import {NavigationCancelingError, PRIMARY_OUTLET, Params} from './shared';
|
||||
import {DefaultUrlHandlingStrategy, UrlHandlingStrategy} from './url_handling_strategy';
|
||||
import {UrlSerializer, UrlTree, containsTree, createEmptyUrlTree} from './url_tree';
|
||||
import {andObservables, forEach, merge, shallowEqual, waitForMap, wrapIntoObservable} from './utils/collection';
|
||||
import {andObservables, forEach, merge, waitForMap, wrapIntoObservable} from './utils/collection';
|
||||
import {TreeNode} from './utils/tree';
|
||||
|
||||
declare var Zone: any;
|
||||
@@ -830,7 +830,7 @@ export class PreActivation {
|
||||
|
||||
// reusing the node
|
||||
if (curr && future._routeConfig === curr._routeConfig) {
|
||||
if (!shallowEqual(future.params, curr.params)) {
|
||||
if (!equalParamsAndUrlSegments(future, curr)) {
|
||||
this.checks.push(new CanDeactivate(outlet.component, curr), new CanActivate(futurePath));
|
||||
} else {
|
||||
// we need to set the data
|
||||
|
||||
@@ -83,8 +83,7 @@ export class RouterPreloader {
|
||||
|
||||
setUpPreloading(): void {
|
||||
const navigations = filter.call(this.router.events, (e: any) => e instanceof NavigationEnd);
|
||||
this.subscription =
|
||||
concatMap.call(navigations, () => this.preload()).subscribe((v: any) => {});
|
||||
this.subscription = concatMap.call(navigations, () => this.preload()).subscribe((v: any) => {});
|
||||
}
|
||||
|
||||
preload(): Observable<any> { return this.processRoutes(this.injector, this.router.config); }
|
||||
|
||||
@@ -12,7 +12,7 @@ import {Observable} from 'rxjs/Observable';
|
||||
|
||||
import {Data, ResolveData, Route} from './config';
|
||||
import {PRIMARY_OUTLET, Params} from './shared';
|
||||
import {UrlSegment, UrlSegmentGroup, UrlTree} from './url_tree';
|
||||
import {UrlSegment, UrlSegmentGroup, UrlTree, equalSegments} from './url_tree';
|
||||
import {merge, shallowEqual, shallowEqualArrays} from './utils/collection';
|
||||
import {Tree, TreeNode} from './utils/tree';
|
||||
|
||||
@@ -448,3 +448,9 @@ export function advanceActivatedRoute(route: ActivatedRoute): void {
|
||||
(<any>route.data).next(route._futureSnapshot.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function equalParamsAndUrlSegments(
|
||||
a: ActivatedRouteSnapshot, b: ActivatedRouteSnapshot): boolean {
|
||||
return shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
|
||||
}
|
||||
Reference in New Issue
Block a user