Skip to content

Commit

Permalink
refactor: clean up reuse tag (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Jan 12, 2021
1 parent f42e6f2 commit 58c32a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Expand Up @@ -23,12 +23,12 @@ export class RouteReusableStrategy extends RouteReuseStrategy {
return null;
}

public shouldReuseRoute(curr: ActivatedRouteSnapshot, future: ActivatedRouteSnapshot): boolean {
public shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
// Reuse the route if the RouteConfig is the same, or if both routes use the
// same component, because the latter can have different RouteConfigs.
return future.routeConfig === curr.routeConfig ||
(!!future.routeConfig?.component &&
future.routeConfig?.component === curr.routeConfig?.component);
(future.routeConfig?.component &&
future.routeConfig?.component === curr.routeConfig?.component);
}

}
4 changes: 1 addition & 3 deletions generators/app/templates/src/app/shell/_shell.service.ts
Expand Up @@ -21,10 +21,8 @@ export class Shell {
component: ShellComponent,
children: routes,
<% if (props.auth) { -%>
canActivate: [AuthenticationGuard],
canActivate: [AuthenticationGuard]
<% } -%>
// Reuse ShellComponent instance when navigating between child views
data: { reuse: true }
};
}
}

0 comments on commit 58c32a7

Please sign in to comment.