Unnecessary calls to retrieve and shouldAttach in RouteReuseStrategy
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
- Open the stackblitz example
- Check the console logs.
- 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