{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/2321","labels_url":"https://api.github.com/repos/angular-ui/ui-router/issues/2321/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-router/issues/2321/comments","events_url":"https://api.github.com/repos/angular-ui/ui-router/issues/2321/events","html_url":"https://github.com/angular-ui/ui-router/issues/2321","id":112548649,"number":2321,"title":"Rejected dependency resolution in a state hierarchy","user":{"login":"bhamon","id":1230647,"avatar_url":"https://avatars.githubusercontent.com/u/1230647?v=3","gravatar_id":"","url":"https://api.github.com/users/bhamon","html_url":"https://github.com/bhamon","followers_url":"https://api.github.com/users/bhamon/followers","following_url":"https://api.github.com/users/bhamon/following{/other_user}","gists_url":"https://api.github.com/users/bhamon/gists{/gist_id}","starred_url":"https://api.github.com/users/bhamon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhamon/subscriptions","organizations_url":"https://api.github.com/users/bhamon/orgs","repos_url":"https://api.github.com/users/bhamon/repos","events_url":"https://api.github.com/users/bhamon/events{/privacy}","received_events_url":"https://api.github.com/users/bhamon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-21T09:36:39Z","updated_at":"2015-10-22T20:54:03Z","closed_at":"2015-10-22T20:54:03Z","body":"I currently works on an app where a state sub-branch requires a request to be performed before everything else. If that request fails, the branch children shouldn't be accessed, especially the dependencies to be resolved.\r\nFor that purpose, I've appended a ``resolve`` dependency that performs the request on the root part of the branch (``path.to.subroot`` for all the ``path.to.subroot.*`` children).\r\n\r\n**The bug :** if the request fails, all the intermediary children ``resolve`` dependencies are executed without consideration.\r\n\r\n[Here](http://plnkr.co/edit/22oF2brkdiH8Mr6rpTzJ?p=preview) is a Plunkr to illustrate this bug. If you click on the link, you can see in the console the resolution of ``foo``, it's rejection, the error caught via the ``$stateChangeError`` hook, **but also** the second dependency (``bar``) that shouldn't be resolved."},"comment":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/comments/150353403","html_url":"https://github.com/angular-ui/ui-router/issues/2321#issuecomment-150353403","issue_url":"https://api.github.com/repos/angular-ui/ui-router/issues/2321","id":150353403,"user":{"login":"nateabele","id":18288,"avatar_url":"https://avatars.githubusercontent.com/u/18288?v=3","gravatar_id":"","url":"https://api.github.com/users/nateabele","html_url":"https://github.com/nateabele","followers_url":"https://api.github.com/users/nateabele/followers","following_url":"https://api.github.com/users/nateabele/following{/other_user}","gists_url":"https://api.github.com/users/nateabele/gists{/gist_id}","starred_url":"https://api.github.com/users/nateabele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nateabele/subscriptions","organizations_url":"https://api.github.com/users/nateabele/orgs","repos_url":"https://api.github.com/users/nateabele/repos","events_url":"https://api.github.com/users/nateabele/events{/privacy}","received_events_url":"https://api.github.com/users/nateabele/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T20:54:02Z","updated_at":"2015-10-22T20:54:02Z","body":"> Just one more thought about that issue : the choice that have been made to load the resolves optmistically seems a bit awkward to me.\r\n\r\nThings are parallelized as much as possible, because loading everything serially would be hugely inefficient.\r\n\r\n> I think that the typical use-case would be to abort resolution on the first error\r\n\r\nYup, except that promises have no generic cancellation mechanism. This is a known design issue and is being tracked in #2126."}}