fix(router): eagerly update internal state on browser-triggered navigations (#43102)

The management of `browserUrlTree` currently has several problems with
correctly tracking the actual state of the browser.

This change makes the Router eagerly update the `browserUrlTree` when
handling navigations triggered by browser events (i.e., not 'imperative'). This
is because with those types of navigations, the browser URL bar is
_already_ updated. If we do not update the internal tracking of the
`browserUrlTree`, we will be out of sync with the real URL if the
navigation is rejected.

It would be best if we could remove `browserUrlTree` completely, but doing that
would require a lot more investigation and is blocked by #27059 because
the SpyLocation used in tests does not emulate real browser behavior.

fixes #43101

PR Close #43102
This commit is contained in:
Andrew Scott
2021-08-10 10:16:01 -07:00
committed by Dylan Hunn
parent b3bb6ec161
commit 286b2807de
4 changed files with 29 additions and 12 deletions
@@ -1526,6 +1526,9 @@
{
"name": "isArrayLike"
},
{
"name": "isBrowserTriggeredNavigation"
},
{
"name": "isCommandWithOutlets"
},