Title: refactor(router): Remove special logic for hybrid apps by atscott · Pull Request #45240 · angular/angular · GitHub
Open Graph Title: refactor(router): Remove special logic for hybrid apps by atscott · Pull Request #45240 · angular/angular
X Title: refactor(router): Remove special logic for hybrid apps by atscott · Pull Request #45240 · angular/angular
Description: This commit removes special (undocumented) logic in the Router code that is meant to prevent duplicate navigations that result from location syncs in AngularJS/Angular hybrid applications. The duplicate navigations can occur when both the Router and the AngularJS sync code detect a location change via a popstate/hashchange event. When this happens, the Angular Router schedules a navigation to sync itself with the browser, but the hybrid listener may also schedule an additional navigation. There are a few reasons this logic should not be included in the Router: This special logic is not tree shakeable so it introduces a bundle size cost for all applications, most of which don't need it. There have been many updates to the routing pipeline to tolerate duplicate navigations. That is, duplicate navigations can happen and routing should still complete successfully. 0e8548f 9e039ca The logic is really in the wrong place: The hybrid sync code should be the location to handle this. If duplicate navigations are meant to be avoided, the hybrid sync code should have handling to not trigger duplicate navs. This logic also used to exist because the mock location helper used for test incorrectly triggered popstate events during router navigations. In order to avoid unexpected behavior in tests, this logic needed to be added. This incorrect mocking may also have been put in place because the upgrade module would see a location change event and trigger a duplicate navigation. The location mock has since been updated to match real browser behavior so this is no longer necessary. The upgrade module has also been updated to not trigger duplicate navigations. The following commits are related to this: 202a1a5 c6a9300 Side note: The setTimeout in the location change listener is used to ensure the ordering of duplicate navigations was consistent. You can see that the logic being removed here expects the imperative navigation to precede the popstate/hashchange. With the removal of this code, the setTimeout no longer serves a purpose. However, it has been found that tests can rely on this behavior (incorrectly) because they expect the navigation to be complete but in reality, it hasn't even started because the test has not flushed the timeout. Removing the timeout would be a breaking change as a result.
Open Graph Description: This commit removes special (undocumented) logic in the Router code that is meant to prevent duplicate navigations that result from location syncs in AngularJS/Angular hybrid applications. The dupl...
X Description: This commit removes special (undocumented) logic in the Router code that is meant to prevent duplicate navigations that result from location syncs in AngularJS/Angular hybrid applications. The dupl...
Opengraph URL: https://github.com/angular/angular/pull/45240
X: @github
Domain: github.com
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ac43e649-9f1e-ff4b-1bda-bc3815101780 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BAB6:29AEE8:1C58BEE:25B60A3:6B0162A1 |
| html-safe-nonce | acefc01989e5a90e2968c56968d919a4c4377a18f8a4f81645783e7407018780 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQUI2OjI5QUVFODoxQzU4QkVFOjI1QjYwQTM6NkIwMTYyQTEiLCJ2aXNpdG9yX2lkIjoiMTQ5OTcyNzYxMjkwNDMwMTIxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e77be9a061804947f27f443e809a70b2c1aa5f14e0d3f281832665d8b6a3aa15 |
| hovercard-subject-tag | pull_request:869807435 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/angular/angular/pull/45240/files |
| twitter:image | https://avatars.githubusercontent.com/u/479713?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/479713?s=400&v=4 |
| og:image:alt | This commit removes special (undocumented) logic in the Router code that is meant to prevent duplicate navigations that result from location syncs in AngularJS/Angular hybrid applications. The dupl... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width