Skip to content

Commit 5ac6f06

Browse files
crisbetothePunderWoman
authored andcommitted
fix(router): avoid component ID collisions with user code (angular#59300)
Currently the `ɵEmptyOutletComponent` is very prone to generating ID collision warnings with user code, because it only has one child and no other metadata. This shows up some of our tests as well. While users can resolve it on their end, it can be confusing since they won't have any references to `ɵEmptyOutletComponent` in their own code. These changes add an `exportAs` to it to make its component ID unique. This doesn't affect the public API of the component since users can't use it directly anyways. PR Close angular#59300
1 parent a088208 commit 5ac6f06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/router/src/components/empty_outlet.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ export {ɵEmptyOutletComponent as EmptyOutletComponent};
2323
* to this `EmptyOutletComponent`.
2424
*/
2525
@Component({
26-
template: `<router-outlet></router-outlet>`,
26+
template: `<router-outlet/>`,
2727
imports: [RouterOutlet],
28+
// Used to avoid component ID collisions with user code.
29+
exportAs: 'emptyRouterOutlet',
2830
})
2931
export class ɵEmptyOutletComponent {}
3032

0 commit comments

Comments
 (0)