Title: Navigation events are called twice when using HashLocationStrategy · Issue #16710 · angular/angular · GitHub
Open Graph Title: Navigation events are called twice when using HashLocationStrategy · Issue #16710 · angular/angular
X Title: Navigation events are called twice when using HashLocationStrategy · Issue #16710 · 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/16710
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Navigation events are called twice when using HashLocationStrategy","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 using `HashLocationStrategy` and change url manually to the one, which is protected by CanActivate guard (this returns false and fire redirect to the other page), navigation events are called twice.\n\n**Expected behavior**\nAll navigation event are called once only.\n\n**Minimal reproduction of the problem with instructions**\nUse the demo in http://plnkr.co/edit/4xlYD9wmetG5G0Dvjp0E?p=preview\nOpen window mode http://run.plnkr.co/plunks/4xlYD9wmetG5G0Dvjp0E/#/component-one\nClick `Guarded Component Two` link - only one `NavigationStart `and `NavigationCancel `events logged in console.\nManually change url from `/#/component-one` to `/#/component-two` and hit enter - two pair of `NavigationStart `and `NavigationCancel` events logged in console.\n\n**What is the motivation / use case for changing the behavior?**\nAs the duplication of navigation event causes guards logic to be executed twice (and this may contain API calls) - it is a performance issue. Potentially, if guard resolving depends on some conditions which are true after first failed attempt - the second one will be successful, however it is not desired behavior.\n\n**Please tell us about your environment:**\n\u003c!-- Operating system, IDE, package manager, HTTP server, ... -->\n\n* **Angular version:** 4.1.0\n\n* **Browser:** Chrome 57\n \n* **Language:** TypeScript","author":{"url":"https://github.com/TetianaP","@type":"Person","name":"TetianaP"},"datePublished":"2017-05-10T23:34:57Z","url":"https://github.com/angular/angular/issues/16710"}
| 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:7c35138e-487f-6e92-2a32-af5a66ae48ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD80:2D2F2F:12649A5:17A4D92:6B010F43 |
| html-safe-nonce | 41c3e840760c76869275d88e057a3a568af8511edc7be5fc94e1411e8f29406b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDgwOjJEMkYyRjoxMjY0OUE1OjE3QTREOTI6NkIwMTBGNDMiLCJ2aXNpdG9yX2lkIjoiMjE3NDY1MTE1NjE4ODQzNDI0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a013a892737630e50a3aafd01a21a33dba25b8cbf324483388704d68703565ae |
| hovercard-subject-tag | issue:227839133 |
| 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/16710/issue_layout |
| twitter:image | https://opengraph.githubassets.com/12015b85ef7f61d99d7626f0f294750dbda81cb3f7e8ddc4756520edd9f5a6fd/angular/angular/issues/16710 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/12015b85ef7f61d99d7626f0f294750dbda81cb3f7e8ddc4756520edd9f5a6fd/angular/angular/issues/16710 |
| 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 | TetianaP |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width