Skip to content

Unnecessary calls to retrieve and shouldAttach in RouteReuseStrategy #23162

@imsingh

Description

@imsingh

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When the first route is rendered. It has unnecessary calls to retrieve, even when shouldReuseRoute returns true.

Expected behavior

It shouldn't run retrieve and shouldAttach at all. Apart from that, sequence of running these function is also wrong. shouldAttach should run first then retrieve. That's my understanding of course.

Minimal reproduction of the problem with instructions

https://stackblitz.com/edit/angular-9yptbr

  1. Open the stackblitz example
  2. Check the console logs.
  3. There are calls to retrieve and shouldAttach, which shouldn't be there at all

What is the motivation / use case for changing the behavior?

Environment


Angular version: 5.2.8


Browser:
- [x] Chrome (desktop) version 65.0.3325.181
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform: Mac 

Others:

I am using CustomStrategy for RouteReuseStrategy, but it is exactly same as DefaultRouteReuseStrategy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions