fix(router): Only retrieve stored route when reuse strategy indicates it should reattach by dimakuba · Pull Request #30263 · angular/angular
When creating the router state, the RouteReuseStrategy#retrieve should
only be called when RouteReuseStrategy#shouldAttach returns true.
That is, we should only retrieve a stored route when the reuse strategy
indicates that there is one stored and that it should be reattached.
This now matches the behavior in the route activation:
| if (this.routeReuseStrategy.shouldAttach(future.snapshot)) { | |
| const stored = | |
| (<DetachedRouteHandleInternal>this.routeReuseStrategy.retrieve(future.snapshot)); |
Fixes #23162