angular/packages/router/upgrade/test
Andrew Scott 202a1a5631 fix(upgrade): Do not trigger duplicate navigation events from Angular Router (#43441)
This code mimics behavior that Google Analytics has been using to
prevent duplicate navigations. They set up their own `HybridRoutingService`
location sync to avoid duplicate navigations that came from the Angular
router. This would happen because the Angular router would trigger a
navigation, which would then get picked up by the `$locationShim`, which
would trigger a `$locationChangeStart`, which would then be picked up by
the `setUpLocationSync` watcher here, which would again trigger a
navigation in the Angular Router.

All of this can be prevented by checking if the `navigationId` exists on
the history state object. This property is added by the Angular router
during navigations.

fixes #21610

PR Close #43441
2022-02-02 19:51:20 +00:00
..
BUILD.bazel test(upgrade): update router upgrade tests to use fewer mocks (#43441) 2022-02-02 19:51:20 +00:00
upgrade.spec.ts fix(upgrade): Do not trigger duplicate navigation events from Angular Router (#43441) 2022-02-02 19:51:20 +00:00
upgrade_location_test_module.ts test(upgrade): update router upgrade tests to use fewer mocks (#43441) 2022-02-02 19:51:20 +00:00