Visitar URL original
docs(router): note that shouldReuseRoute doesn't rerun guards and res… · angular/angular@d98ee02 · GitHub
Skip to content

Commit d98ee02

Browse files
aminesbdevNothingEverHappens
authored andcommitted
docs(router): note that shouldReuseRoute doesn't rerun guards and resolvers
Returning `false` from `RouteReuseStrategy.shouldReuseRoute` recreates the component, but guards and resolvers only rerun for an unchanged route configuration as configured by `runGuardsAndResolvers`. Add a short note to the `shouldReuseRoute` docs pointing to `RunGuardsAndResolvers`. Closes #70965 (cherry picked from commit 95383cd)
1 parent d0b0e4e commit d98ee02

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/router/src/route_reuse_strategy.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ export abstract class RouteReuseStrategy {
8383
/** Retrieves the previously stored route */
8484
abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null;
8585

86-
/** Determines if a route should be reused */
86+
/**
87+
* Determines if a route should be reused.
88+
*
89+
* Note: Recreating a component by returning `false` does not automatically rerun guards or
90+
* resolvers; rerun behavior for an unchanged route configuration is controlled by
91+
* {@link RunGuardsAndResolvers}.
92+
*
93+
* @see {@link RunGuardsAndResolvers}
94+
*/
8795
abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
8896

8997
/**

0 commit comments

Comments
 (0)