From df231ad572521344edd62034e154c8689e4bb227 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Thu, 19 Nov 2020 16:17:12 +0100 Subject: [PATCH] fix(router): remove duplicated getOutlet function (#39764) The codebase currently contains two `getOutlet` functions, and they can end up in the bundle of an application. A recent commit 6fbe21941d7ad1bab7441e1bf3c667ecffc7a359 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 --- .../core/test/bundling/router/bundle.golden_symbols.json | 3 --- packages/router/src/recognize.ts | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/core/test/bundling/router/bundle.golden_symbols.json b/packages/core/test/bundling/router/bundle.golden_symbols.json index c30a0e37087de..795e037553550 100644 --- a/packages/core/test/bundling/router/bundle.golden_symbols.json +++ b/packages/core/test/bundling/router/bundle.golden_symbols.json @@ -1379,9 +1379,6 @@ { "name": "getOutlet" }, - { - "name": "getOutlet" - }, { "name": "getOwnDefinition" }, diff --git a/packages/router/src/recognize.ts b/packages/router/src/recognize.ts index 336a5afe8ff3b..20cf0382167b3 100644 --- a/packages/router/src/recognize.ts +++ b/packages/router/src/recognize.ts @@ -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 {} @@ -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 || {}; }