RouterOutlet#reuse checks if there is no current _componentRef and in that case creates a new component.
However, _componentRef is not set until the call to DynamicComponentLoader.loadNextToLocation is finished (in RouterOutlet#activate). If that call takes a bit longer (e.g. loading an html file from the server) RouterOutlet will create 2 instances of the component.
On my branch for codegen templates that changes the timing of DynamicComponentLoading a bit, the test for syncRoutesWithDynamicComponents (in sync_route_spec_impl.ts) fails because of this.
RouterOutlet#reusechecks if there is no current_componentRefand in that case creates a new component.However,
_componentRefis not set until the call toDynamicComponentLoader.loadNextToLocationis finished (inRouterOutlet#activate). If that call takes a bit longer (e.g. loading an html file from the server)RouterOutletwill create 2 instances of the component.On my branch for codegen templates that changes the timing of
DynamicComponentLoadinga bit, the test forsyncRoutesWithDynamicComponents(insync_route_spec_impl.ts) fails because of this.