Title: CanActivate guards on child routes run before parent CanActivate guards finish · Issue #15670 · angular/angular · GitHub
Open Graph Title: CanActivate guards on child routes run before parent CanActivate guards finish · Issue #15670 · angular/angular
X Title: CanActivate guards on child routes run before parent CanActivate guards finish · Issue #15670 · angular/angular
Description: I'm submitting a ... (check one with "x") [X] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/an...
Open Graph Description: I'm submitting a ... (check one with "x") [X] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request...
X Description: I'm submitting a ... (check one with "x") [X] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not su...
Opengraph URL: https://github.com/angular/angular/issues/15670
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CanActivate guards on child routes run before parent CanActivate guards finish","articleBody":"\u003c!--\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\n-->\n\n**I'm submitting a ...** (check one with \"x\")\n```\n[X] bug report => search github for a similar issue or PR before submitting\n[ ] feature request\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\n```\n\n**Current behavior**\nWhen both a route and it's parent have an asynchronous `canActivate` guard, and the child is navigated to directly, both guards are run at same time.\n\n**Expected behavior**\nThe parent's `canActivate` guard should run before the child's guard. If the parent's guard is unsuccessful the child guard should not be run. If a route defines multiple `canActivate` guards, those can/should be run in parallel.\n\n**Minimal reproduction of the problem with instructions**\nhttp://plnkr.co/edit/s4R0INS7qjuFnRpyD8eF?p=preview\n\nPlunker has a nested route `/parent/child`. Both have guards that simply wait and then return true. Each guard logs its start/end as well as a tick once per second to a logging service that is displayed in the root component.\n\nClick 'Go to Child` to trigger both the Parent Guard and the Child guard at the same time, and observe that they process simultaneously in the log.\n\n**What is the motivation / use case for changing the behavior?**\n\nIn my athepp, `ParentGuard` checks to see if the user is authenticated and redirects accordingly, and `ChildGuard` loads protected data. Right now, my child guard cannot assume the user is logged in, so I have to duplicate logic from the authorization guard to wait for the user to be loaded. When I have a grandchild route, that has to duplicate logic from two parent guards. I would like to be able to separate concerns more rather than duplicate auth logic in all my guards.\n\n**Please tell us about your environment:**\n\u003c!-- Operating system, IDE, package manager, HTTP server, ... -->\n\n* **Angular version:** 4.0.1\n\u003c!-- Check whether this is still an issue in the most recent Angular version -->","author":{"url":"https://github.com/adharris","@type":"Person","name":"adharris"},"datePublished":"2017-03-31T16:15:50Z","url":"https://github.com/angular/angular/issues/15670"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ec66f238-18f7-8cca-f84f-cb52effc5112 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E06:2DBB21:C12FA7:102B06B:6B00FA2D |
| html-safe-nonce | 1e5067f728bec961348a5774c9432a776e863e89919bcef150e121569c96378f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTA2OjJEQkIyMTpDMTJGQTc6MTAyQjA2Qjo2QjAwRkEyRCIsInZpc2l0b3JfaWQiOiI4NTI4OTgzODI4MTM0NDI3MTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c52ce46e64034576ba3b41c7c7ab464be09cdfef287a63d5629b64757447e4d2 |
| hovercard-subject-tag | issue:218549949 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/15670/issue_layout |
| twitter:image | https://opengraph.githubassets.com/78d0cbd96d1fc8d2f63bfb4581575ffc75047322c0fc1e4b1cbbf4fbdd267dd6/angular/angular/issues/15670 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/78d0cbd96d1fc8d2f63bfb4581575ffc75047322c0fc1e4b1cbbf4fbdd267dd6/angular/angular/issues/15670 |
| og:image:alt | I'm submitting a ... (check one with "x") [X] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adharris |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width