Title: refactor(router): Remove unnecessary setTimeout in UrlTree redirects by atscott · Pull Request #45735 · angular/angular · GitHub
Open Graph Title: refactor(router): Remove unnecessary setTimeout in UrlTree redirects by atscott · Pull Request #45735 · angular/angular
X Title: refactor(router): Remove unnecessary setTimeout in UrlTree redirects by atscott · Pull Request #45735 · angular/angular
Description: Using setTimeout in the Router navigation pipeline creates fragile and unpredictable behavior. Additionally, it creates a new macrotask, which would trigger an unnecessary change detection in the application. This setTimeout was added in 15e3978. Both tests added in that commit still pass. Additionally, the comment for why the setTimeout was added doesn't really explain how the described bug would occur. There has been a lot of work in the Router since then to stabalize edge case scenarios so it's possible it existed before but doesn't anymore. Removing this setTimeout revealed tests that relied on the navigation not completing. For example, the test suite did not have a route which matched the redirect, but the test passed because it ended before the redirect was flushed, so the Router never threw an error. Similar situations exist for the other use of setTimeout in the Route (the one in the location change listener). There were no other failures in TGP other than incorrectly written tests. BREAKING CHANGE: When a guard returns a UrlTree, the router would previously schedule the redirect navigation within a setTimeout. This timeout is now removed, which can result in test failures due to incorrectly written tests. Tests which perform navigations should ensure that all timeouts are flushed before making assertions. Tests should ensure they are capable of handling all redirects from the original navigation.
Open Graph Description: Using setTimeout in the Router navigation pipeline creates fragile and unpredictable behavior. Additionally, it creates a new macrotask, which would trigger an unnecessary change detection in the a...
X Description: Using setTimeout in the Router navigation pipeline creates fragile and unpredictable behavior. Additionally, it creates a new macrotask, which would trigger an unnecessary change detection in the a...
Opengraph URL: https://github.com/angular/angular/pull/45735
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:885b3f19-c667-ff3f-dee6-17998618dbf7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E8DE:296654:B6782D:F5ABDF:6B00F52B |
| html-safe-nonce | 689918e8f24574a034bc2ccb6a1647e40a0a4a7594475935f39d0789fc395e3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOERFOjI5NjY1NDpCNjc4MkQ6RjVBQkRGOjZCMDBGNTJCIiwidmlzaXRvcl9pZCI6Ijc5Njg1NzQxMTE2NDU0OTY2MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d417d6579b23109ab100ca6db66ce5c474ce9b5159b8213fb51792158c1dbc73 |
| hovercard-subject-tag | pull_request:917217754 |
| 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/45735/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 | Using setTimeout in the Router navigation pipeline creates fragile and unpredictable behavior. Additionally, it creates a new macrotask, which would trigger an unnecessary change detection in the a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 |
| disable-turbo | true |
| 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 |
Links:
Viewport: width=device-width