@@ -11,7 +11,7 @@ import {attachPatchData} from './context_discovery';
11
11
import { callHooks } from './hooks' ;
12
12
import { LContainer , NATIVE , VIEWS , unusedValueExportToPlacateAjd as unused1 } from './interfaces/container' ;
13
13
import { ComponentDef } from './interfaces/definition' ;
14
- import { TContainerNode , TElementContainerNode , TElementNode , TNode , TNodeFlags , TNodeType , TViewNode , unusedValueExportToPlacateAjd as unused2 } from './interfaces/node' ;
14
+ import { TContainerNode , TElementContainerNode , TElementNode , TNode , TNodeFlags , TNodeType , TProjectionNode , TViewNode , unusedValueExportToPlacateAjd as unused2 } from './interfaces/node' ;
15
15
import { unusedValueExportToPlacateAjd as unused3 } from './interfaces/projection' ;
16
16
import { ProceduralRenderer3 , RComment , RElement , RNode , RText , Renderer3 , isProceduralRenderer , unusedValueExportToPlacateAjd as unused4 } from './interfaces/renderer' ;
17
17
import { CLEANUP , CONTAINER_INDEX , FLAGS , HEADER_OFFSET , HOST_NODE , HookData , LView , LViewFlags , NEXT , PARENT , QUERIES , RENDERER , TVIEW , unusedValueExportToPlacateAjd as unused5 } from './interfaces/view' ;
@@ -242,17 +242,14 @@ export function destroyViewTree(rootView: LView): void {
242
242
while ( viewOrContainer ) {
243
243
let next : LView | LContainer | null = null ;
244
244
245
- if ( isLContainer ( viewOrContainer ) ) {
246
- // If container, traverse down to its first LView.
247
- const container = viewOrContainer as LContainer ;
248
- const viewsInContainer = container [ VIEWS ] ;
249
- if ( viewsInContainer . length ) {
250
- next = viewsInContainer [ 0 ] ;
251
- }
252
- } else {
245
+ if ( viewOrContainer . length >= HEADER_OFFSET ) {
253
246
// If LView, traverse down to child.
254
247
const view = viewOrContainer as LView ;
255
248
if ( view [ TVIEW ] . childIndex > - 1 ) next = getLViewChild ( view ) ;
249
+ } else {
250
+ // If container, traverse down to its first LView.
251
+ const container = viewOrContainer as LContainer ;
252
+ if ( container [ VIEWS ] . length ) next = container [ VIEWS ] [ 0 ] ;
256
253
}
257
254
258
255
if ( next == null ) {
@@ -261,15 +258,6 @@ export function destroyViewTree(rootView: LView): void {
261
258
while ( viewOrContainer && ! viewOrContainer ! [ NEXT ] && viewOrContainer !== rootView ) {
262
259
cleanUpView ( viewOrContainer ) ;
263
260
viewOrContainer = getParentState ( viewOrContainer , rootView ) ;
264
- if ( isLContainer ( viewOrContainer ) ) {
265
- // this view will be destroyed so we need to notify queries that a view is detached
266
- const viewsInContainer = ( viewOrContainer as LContainer ) [ VIEWS ] ;
267
- for ( let viewToDetach of viewsInContainer ) {
268
- if ( viewToDetach [ QUERIES ] ) {
269
- viewToDetach [ QUERIES ] ! . removeView ( ) ;
270
- }
271
- }
272
- }
273
261
}
274
262
cleanUpView ( viewOrContainer || rootView ) ;
275
263
next = viewOrContainer && viewOrContainer ! [ NEXT ] ;
0 commit comments