@@ -337,8 +337,8 @@ export function renderComponentOrTemplate<T>(
337337 template ( componentOrContext ! , creationMode ) ;
338338 } else {
339339 // Element was stored at 0 and directive was stored at 1 in renderComponent
340- // so to refresh the component, r () needs to be called with (1, 0)
341- ( componentOrContext . constructor as ComponentType < T > ) . ngComponentDef . r ( 1 , 0 ) ;
340+ // so to refresh the component, refresh () needs to be called with (1, 0)
341+ componentRefresh ( 1 , 0 ) ;
342342 }
343343 } finally {
344344 if ( rendererFactory . end ) {
@@ -1161,28 +1161,27 @@ export function viewEnd(): void {
11611161 *
11621162 * @param directiveIndex
11631163 * @param elementIndex
1164- * @param template
11651164 */
1166- export const componentRefresh :
1167- < T > ( directiveIndex : number , elementIndex : number , template : ComponentTemplate < T > ) =>
1168- void = function < T > (
1169- directiveIndex : number , elementIndex : number , template : ComponentTemplate < T > ) {
1170- ngDevMode && assertDataInRange ( elementIndex ) ;
1171- const element = data ! [ elementIndex ] as LElementNode ;
1172- ngDevMode && assertNodeOfPossibleTypes ( element , LNodeFlags . Element , LNodeFlags . Container ) ;
1173- ngDevMode && assertNotEqual ( element . data , null , 'isComponent' ) ;
1174- ngDevMode && assertDataInRange ( directiveIndex ) ;
1175- const hostView = element . data ! ;
1176- ngDevMode && assertNotEqual ( hostView , null , 'hostView' ) ;
1165+ export function componentRefresh < T > ( directiveIndex : number , elementIndex : number ) : void {
11771166 executeInitHooks ( currentView ) ;
11781167 executeContentHooks ( currentView ) ;
1179- const directive = data [ directiveIndex ] ;
1180- const oldView = enterView ( hostView , element ) ;
1181- try {
1182- template ( directive , creationMode ) ;
1183- } finally {
1184- refreshDynamicChildren ( ) ;
1185- leaveView ( oldView ) ;
1168+ const template = ( tData [ directiveIndex ] as ComponentDef < T > ) . template ;
1169+ if ( template != null ) {
1170+ ngDevMode && assertDataInRange ( elementIndex ) ;
1171+ const element = data ! [ elementIndex ] as LElementNode ;
1172+ ngDevMode && assertNodeType ( element , LNodeFlags . Element ) ;
1173+ ngDevMode && assertNotEqual ( element . data , null , 'isComponent' ) ;
1174+ ngDevMode && assertDataInRange ( directiveIndex ) ;
1175+ const directive = data [ directiveIndex ] ;
1176+ const hostView = element . data ! ;
1177+ ngDevMode && assertNotEqual ( hostView , null , 'hostView' ) ;
1178+ const oldView = enterView ( hostView , element ) ;
1179+ try {
1180+ template ( directive , creationMode ) ;
1181+ } finally {
1182+ refreshDynamicChildren ( ) ;
1183+ leaveView ( oldView ) ;
1184+ }
11861185 }
11871186} ;
11881187
0 commit comments