Title: Async guards should have the option to wait for previous guards to finish · Issue #40577 · angular/angular · GitHub
Open Graph Title: Async guards should have the option to wait for previous guards to finish · Issue #40577 · angular/angular
X Title: Async guards should have the option to wait for previous guards to finish · Issue #40577 · angular/angular
Description: This is a copy of #21702 which has been locked due to inactivity. Still it is relevant. I'm submitting a... [ ] Regression [ ] Bug report [X] Feature request [ ] Documentation issue or request [ ] Support request Current behavior When ha...
Open Graph Description: This is a copy of #21702 which has been locked due to inactivity. Still it is relevant. I'm submitting a... [ ] Regression [ ] Bug report [X] Feature request [ ] Documentation issue or request [ ] ...
X Description: This is a copy of #21702 which has been locked due to inactivity. Still it is relevant. I'm submitting a... [ ] Regression [ ] Bug report [X] Feature request [ ] Documentation issue or request ...
Opengraph URL: https://github.com/angular/angular/issues/40577
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Async guards should have the option to wait for previous guards to finish","articleBody":"This is a copy of #21702 which has been locked due to inactivity. Still it is relevant.\r\n\r\n### I'm submitting a...\r\n\r\n[ ] Regression\r\n[ ] Bug report\r\n[X] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request\r\n\r\n### Current behavior\r\n\r\nWhen having multiple async guards (returning promise or observable) for the same path they execute at the same time:\r\n\r\n```ts\r\n{\r\n path: '',\r\n canActivate: [\r\n AuthGuard,\r\n DetectLanguage,\r\n GetAppData,\r\n ],\r\n children: [ ... ]\r\n}\r\n```\r\n\r\n### Expected behavior\r\n\r\nThere should be an option to let them execute synchronous: \r\n\r\n- guard[i+1] should wait for guard[i] to finish\r\n- If guard[i] returns false all following guards should not execute\r\n\r\n### What is the motivation / use case for changing the behavior?\r\n\r\nThe example above has an authentication which needs to be done first before getting the app data. AuthGuard returns a token that needs to be used within GetAppData. Currently GetAppData runs immediatly without having a token.\r\n\r\n### Workaround\r\n\r\nKinda ugly and confusing workaround:\r\n\r\n```ts\r\n{\r\n path: '',\r\n canActivate: [\r\n AuthGuard,\r\n ],\r\n children: [\r\n {\r\n path: '',\r\n canActivate: [\r\n DetectLanguage,\r\n ],\r\n children: [\r\n {\r\n path: '',\r\n canActivate: [\r\n GetAppdata,\r\n ],\r\n component: MyComponent,\r\n }\r\n }\r\n ]\r\n }\r\n```","author":{"url":"https://github.com/MickL","@type":"Person","name":"MickL"},"datePublished":"2021-01-26T14:54:08Z","url":"https://github.com/angular/angular/issues/40577"}
| 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:c352e5ad-16d3-d578-2a1d-aa278abc26f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABA2:1AE20C:9371C9:BC146A:6B00EC6B |
| html-safe-nonce | edb1c41851658d90bcec2898778e10feaa0a347c8143df8a841576df4b90282d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkEyOjFBRTIwQzo5MzcxQzk6QkMxNDZBOjZCMDBFQzZCIiwidmlzaXRvcl9pZCI6IjE3NTA1ODQ0NDk2Mzg2Nzc1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e717e6c47235450f69cb6edc9ec2ba77277a7426d307330308a6791dd82862d0 |
| hovercard-subject-tag | issue:794296370 |
| 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/40577/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bfbc196802918d553b22b9e98660c17ad6a5192d753bb546195404aff7586b11/angular/angular/issues/40577 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bfbc196802918d553b22b9e98660c17ad6a5192d753bb546195404aff7586b11/angular/angular/issues/40577 |
| og:image:alt | This is a copy of #21702 which has been locked due to inactivity. Still it is relevant. I'm submitting a... [ ] Regression [ ] Bug report [X] Feature request [ ] Documentation issue or request [ ] ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MickL |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width