Skip to content

Commit

Permalink
refactor(router): initalize browserUrlTree to empty tree (angular#28376)
Browse files Browse the repository at this point in the history
The value here is unimportant on initialization since it's not looked at until the second navigation. However, sometimes in testing  the `Location` service is mocked out, or the Router constructor manually called. Assuming `Location` exists in the constructor leads to test failures in `google3` therefore we initialize to a value that will not cause errors.

PR Close angular#28376
  • Loading branch information
jasonaden authored and wKoza committed Jan 26, 2019
1 parent e2c98fb commit 6e026a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export class Router {
this.resetConfig(config);
this.currentUrlTree = createEmptyUrlTree();
this.rawUrlTree = this.currentUrlTree;
this.browserUrlTree = this.parseUrl(this.location.path());
this.browserUrlTree = this.currentUrlTree;

this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd);
this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
Expand Down

0 comments on commit 6e026a0

Please sign in to comment.