You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run multiple resolvers concurrently in router. #14279
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
I set multiple resolvers in my route:
then all requests will be ran concurrently, very implicit behavior...
Expected behavior
No matter what resolve() method return (Observable or Promise) all async operations should be ran concurrently.
What is the motivation / use case for changing the behavior?
For users: Improve UX when router pre-fetch data.
For developers: More explicit router API.
Please tell us about your environment:
@angular/cli: 1.0.0-beta.30
node: 6.2.2
os: darwin x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1
This looks interesting. I've currently got the problem whereby at a single route I need to wait for data from the result of one resolvers service call to complete before calling another service with the previous resolved data. How would I be able to do this with the above changes?
Reacted by gloomygentleman, Aleksei Lebedev, Richard Milne, jotwea, Luca Mancini, pierre-luc and Alexander Takchidi
Note : We can get the data loaded by Data1Resolver inside the resolve method of SubData1Resolver. So that synchronous resolver can be called and data can be shared.
Reacted by gloomygentleman, Steven Rowe, Luca Mancini, dmitriytretyakov, Gleb Mikheev, shastaxc, Kartik Jagdale and Jeffrey Meyer
That looks good. Just to clarify - You'd get the choice of both, data1 & data2 resolve concurrently. And subdata1 values resolve sequentially after data1 values are resolved. Is this not available already? It sounds like it would be a solution to a very common problem, I haven't found anything on the Angular site.
Hi I would like to know the state of this issue since I do not want to run my resolvers concurrently. I would need them to be executed sequentially. @hibumbapartha is your code working?
Actually i need the opposite: One guard (resolve or canActivate) should WAIT for the previous before it executes. I have to prevent concurrent execution.
Activity
saedwards commentedon May 17, 2017
This looks interesting. I've currently got the problem whereby at a single route I need to wait for data from the result of one resolvers service call to complete before calling another service with the previous resolved data. How would I be able to do this with the above changes?
bumbapartha commentedon May 26, 2017
We could have a chain of resolver dependency to solve this problem. May be the the following approach can be used.
Note : We can get the data loaded by Data1Resolver inside the resolve method of SubData1Resolver. So that synchronous resolver can be called and data can be shared.
saedwards commentedon May 29, 2017
That looks good. Just to clarify - You'd get the choice of both, data1 & data2 resolve concurrently. And subdata1 values resolve sequentially after data1 values are resolved. Is this not available already? It sounds like it would be a solution to a very common problem, I haven't found anything on the Angular site.
fix(router): should run resolvers for the same route concurrently
fix(router): should run resolvers for the same route concurrently
bhaidar commentedon Aug 10, 2017
Is this feature available now in Angular 4? If I have multiple resolvers, would they run concurrently?
fix(router): should run resolvers for the same route concurrently
fix(router): should run resolvers for the same route concurrently
fix(router): should run resolvers for the same route concurrently
brandon7810 commentedon Jan 9, 2018
Hi I would like to know the state of this issue since I do not want to run my resolvers concurrently. I would need them to be executed sequentially. @hibumbapartha is your code working?
MickL commentedon Jan 22, 2018
Actually i need the opposite: One guard (resolve or canActivate) should WAIT for the previous before it executes. I have to prevent concurrent execution.
felipe-norato commentedon Jan 25, 2018
@MickL I need the same thing!
MickL commentedon Jan 26, 2018
I opened a issue here: #21702
Feel free to give it a thumbs up
stevedeighton commentedon Mar 21, 2018
So to clarify, there's no in built way to resolve multiple one after each other, like how it used to work?
'cause if so this makes me weep a little!
angular-automatic-lock-bot commentedon Sep 13, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.