René's URL Explorer Experiment


Title: Changing the URI in the browser directly will fire guards and resolvers of the route TWICE · Issue #41782 · angular/angular · GitHub

Open Graph Title: Changing the URI in the browser directly will fire guards and resolvers of the route TWICE · Issue #41782 · angular/angular

X Title: Changing the URI in the browser directly will fire guards and resolvers of the route TWICE · Issue #41782 · angular/angular

Description: 🐞 Changing the URI in the browser directly will fire guards and resolvers of the route TWICE Affected Package The issue is caused by package @angular/router when using "useHash: true" FYI / Heads Up: This issue is reproducible in Firefox...

Open Graph Description: 🐞 Changing the URI in the browser directly will fire guards and resolvers of the route TWICE Affected Package The issue is caused by package @angular/router when using "useHash: true" FYI / Heads U...

X Description: 🐞 Changing the URI in the browser directly will fire guards and resolvers of the route TWICE Affected Package The issue is caused by package @angular/router when using "useHash: true" FYI...

Opengraph URL: https://github.com/angular/angular/issues/41782

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Changing the URI in the browser directly will fire guards and resolvers of the route TWICE","articleBody":"# 🐞 Changing the URI in the browser directly will fire guards and resolvers of the route TWICE\r\n\r\n\r\n### Affected Package\r\nThe issue is caused by package @angular/router when using \"useHash: true\"\r\n\r\n\r\n**FYI / Heads Up:** This issue is reproducible in Firefox based browsers ONLY - so it MAY be a browser bug (emitting the 'popstate' / 'hashchange' events). On the other hand - it may be working in Chromium based browsers because of sheer race-condition luck, I don't know.\r\n\r\nThis issue is reproducible with Waterfox G3.2.1 64-Bit (which is based on Firefox ESR), and the up-to-date (as of this writing) versions of regular Firefox and its Developer Edition.\r\n\r\n\r\n### Description\r\n\r\nWhen changing the URL in the browser's location bar *directly* - by\r\n- copy/pasting a link from an email into it\r\n- dragging a link from the Angular app into it\r\n- or just manually typing it\r\n\r\nthe guards and resolvers of this route will fire TWICE each.\r\n\r\n**This is especially bad when the resolver is trying to get a LOCK for a mutable resource!!**\r\nWeird things happen: While the component to update the resource is about to be created by the Angular router, the second resolve fails (because the resource is locked now) and redirects the user to some kind of resource overview page. **So the lock is now being held by US (unknowingly).**\r\n\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\n[https://stackblitz.com/edit/angular-11-hashchange-bug](Stackblitz)\r\nPlease remember the issue only manifests when dragging the link into the URI bar.\r\nClicking the links (and thus opening a new window) works as expected. 👍\r\n\r\n## Demonstration\r\n![ng11-hashchange-bug](https://user-images.githubusercontent.com/4144388/115863098-4606ba00-a435-11eb-97e5-3195770bcfc7.gif)\r\n\r\n### Expectation:\r\n1. the guard will fire (once!)\r\n2. on error the router redirects (once!)\r\n3. on success the routing process continues\r\n4. the resolver will fire (once!)\r\n5. on error the router redirects (once!)\r\n6. on success the lock.component is created and everything is fine\r\n\r\n### Outcome:\r\nAs you can see, the guard and resolver fire twice for a single URI change. The outcome is based on the combination of whether the guard and the resolver are succeeding or not. There are multiple variants, the worst one being the one described above at 'This is especially bad...'.\r\nBut if the resource was locked (e.g. by a third-party) already - it can result in double error boxes, etc.\r\n\r\n\r\n\r\n### Here is a browser log of a case:\r\n![image](https://user-images.githubusercontent.com/4144388/115865326-7439c900-a438-11eb-8cb8-90dfccfaab53.png)\r\n\r\nAfter the routing to '/redirect-to' just finished (NavigationEnd / Scroll) - just milliseconds later the router is detecting a request to route to '/lock-something' again (with navigationTrigger: \"hashchange\") and re-starts the navigation (NavigationStart) - including all guards and resolvers of course! 😶\r\n\r\n\r\n\r\n\r\n## 🌍  Your Environment\r\n\u003cpre>\u003ccode>\r\n     _                      _                 ____ _     ___\r\n    / \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|\r\n   / △ \\ | '_ \\ / _` | | | | |/ _` | '__|   | |   | |    | |\r\n  / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |\r\n /_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|\r\n                |___/\r\n\r\n\r\nAngular CLI: 11.2.10\r\nNode: 14.13.1\r\nOS: win32 x64\r\n\r\nAngular: 11.2.11\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... platform-browser, platform-browser-dynamic, router\r\nIvy Workspace: Yes\r\n\r\nPackage                         Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect       0.1102.10\r\n@angular-devkit/build-angular   0.1102.10\r\n@angular-devkit/core            11.2.10\r\n@angular-devkit/schematics      11.2.10\r\n@angular/cli                    11.2.10\r\n@schematics/angular             11.2.10\r\n@schematics/update              0.1102.10\r\nrxjs                            6.6.7\r\ntypescript                      4.1.5\r\n\u003c/code>\u003c/pre>\r\n\r\n\r\nP.S.: This bug sounds a lot like it should've been squashed by this PR: https://github.com/angular/angular/pull/37674\r\nBut it still remains in Angular 11.2.11","author":{"url":"https://github.com/Sgt-Nukem","@type":"Person","name":"Sgt-Nukem"},"datePublished":"2021-04-23T11:50:18Z","url":"https://github.com/angular/angular/issues/41782"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:43a579c4-6bf7-924b-7979-5dafb9a3cd0c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE6C6:2D40DE:1D3948:250626:6B00FCA3
html-safe-noncea8f0c525996ffbe42f557adb31171a8ccce337a0774fffe50b6d0e0efa2b9503
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkM2OjJENDBERToxRDM5NDg6MjUwNjI2OjZCMDBGQ0EzIiwidmlzaXRvcl9pZCI6IjMxNDc0MDY3NzAzNDQ0MTg5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf5fe04dcf1359dd880a81e9ad393e885a6b9a68c7972431561082b7076792858
hovercard-subject-tagissue:866037313
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/41782/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a61f368d6eed1c6e0b39db78a2d5f5f845e5c64a5f80114132a260d5c69002fb/angular/angular/issues/41782
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a61f368d6eed1c6e0b39db78a2d5f5f845e5c64a5f80114132a260d5c69002fb/angular/angular/issues/41782
og:image:alt🐞 Changing the URI in the browser directly will fire guards and resolvers of the route TWICE Affected Package The issue is caused by package @angular/router when using "useHash: true" FYI / Heads U...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSgt-Nukem
hostnamegithub.com
expected-hostnamegithub.com
Nonee208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7dafd017fb7809a839c443dba08622af38e63c09
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/41782#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F41782
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F41782
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/41782
Reloadhttps://github.com/angular/angular/issues/41782
Reloadhttps://github.com/angular/angular/issues/41782
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/41782
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/41782
Changing the URI in the browser directly will fire guards and resolvers of the route TWICEhttps://github.com/angular/angular/issues/41782#top
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
area: routerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20router%22
browser: firefoxhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22browser%3A%20firefox%22
router: navigation pipeevents/scheduleNavigation/transitions observablehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22router%3A%20navigation%20pipe%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/Sgt-Nukem
Sgt-Nukemhttps://github.com/Sgt-Nukem
on Apr 23, 2021https://github.com/angular/angular/issues/41782#issue-866037313
https://stackblitz.com/edit/angular-11-hashchange-bughttps://github.com/angular/angular/issues/Stackblitz
https://user-images.githubusercontent.com/4144388/115863098-4606ba00-a435-11eb-97e5-3195770bcfc7.gif
https://user-images.githubusercontent.com/4144388/115865326-7439c900-a438-11eb-8cb8-90dfccfaab53.png
#37674https://github.com/angular/angular/pull/37674
AndrewKushnirhttps://github.com/AndrewKushnir
browser: firefoxhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22browser%3A%20firefox%22
area: routerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20router%22
on Apr 23, 2021https://github.com/angular/angular/issues/41782#event-4637628292
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Apr 23, 2021https://github.com/angular/angular/issues/41782#event-4637628361
atscotthttps://github.com/atscott
P4A relatively minor issue that is not relevant to core functionshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P4%22
router: navigation pipeevents/scheduleNavigation/transitions observablehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22router%3A%20navigation%20pipe%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
on Apr 23, 2021https://github.com/angular/angular/issues/41782#event-4638108665
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Apr 23, 2021https://github.com/angular/angular/issues/41782#event-4638108721
atscotthttps://github.com/atscott
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
P4A relatively minor issue that is not relevant to core functionshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P4%22
on Apr 23, 2021https://github.com/angular/angular/issues/41782#event-4638113791
atscotthttps://github.com/atscott
on Sep 2, 2021https://github.com/angular/angular/issues/41782#event-5249903597
fix(router): Only trigger router navigation on `popstate` events from…https://github.com/atscott/angular/commit/870767502f6583b018a8b7eb24880f84891d9e23
https://docs.github.com/articles/closing-issues-via-commit-messages
8707675https://github.com/atscott/angular/commit/870767502f6583b018a8b7eb24880f84891d9e23
atscotthttps://github.com/atscott
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
9e039cahttps://github.com/angular/angular/commit/9e039ca68bfae5328f3fc1f16fabd7673c466a25
on Sep 8, 2021https://github.com/angular/angular/issues/41782#event-5273601647
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Oct 9, 2021https://github.com/angular/angular/issues/41782#issuecomment-939320287
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Oct 9, 2021https://github.com/angular/angular/issues/41782#event-5438280375
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/41782
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/41782
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
area: routerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20router%22
browser: firefoxhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22browser%3A%20firefox%22
router: navigation pipeevents/scheduleNavigation/transitions observablehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22router%3A%20navigation%20pipe%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.