Skip to content

Commit

Permalink
fix(router): remove duplicated getOutlet function (#39764)
Browse files Browse the repository at this point in the history
The codebase currently contains two `getOutlet` functions,
and they can end up in the bundle of an application.
A recent commit 6fbe219 tipped us off
as it introduced several `noop` occurrences in the golden symbol files.
After investigating with @petebacondarwin,
we decided to remove the duplicated functions.

This probably shaves only a few bytes,
but this commit removes the duplicated functions,
by always using the one in `router/src/utils/config`.

PR Close #39764
  • Loading branch information
cexbrayat authored and AndrewKushnir committed Nov 20, 2020
1 parent babbf8a commit df231ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
3 changes: 0 additions & 3 deletions packages/core/test/bundling/router/bundle.golden_symbols.json
Expand Up @@ -1379,9 +1379,6 @@
{
"name": "getOutlet"
},
{
"name": "getOutlet"
},
{
"name": "getOwnDefinition"
},
Expand Down
5 changes: 1 addition & 4 deletions packages/router/src/recognize.ts
Expand Up @@ -14,6 +14,7 @@ import {ActivatedRouteSnapshot, inheritedParamsDataResolve, ParamsInheritanceStr
import {defaultUrlMatcher, PRIMARY_OUTLET} from './shared';
import {mapChildrenIntoArray, UrlSegment, UrlSegmentGroup, UrlTree} from './url_tree';
import {forEach, last} from './utils/collection';
import {getOutlet} from './utils/config';
import {TreeNode} from './utils/tree';

class NoMatch {}
Expand Down Expand Up @@ -328,10 +329,6 @@ function emptyPathMatch(
return r.path === '' && r.redirectTo === undefined;
}

function getOutlet(route: Route): string {
return route.outlet || PRIMARY_OUTLET;
}

function getData(route: Route): Data {
return route.data || {};
}
Expand Down

0 comments on commit df231ad

Please sign in to comment.