File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,9 @@ export class RenderViewHydrator {
180180
181181 _viewContainerDehydrateRecurse ( viewContainer ) {
182182 for ( var i = 0 ; i < viewContainer . views . length ; i ++ ) {
183- this . _viewDehydrateRecurse ( viewContainer . views [ i ] ) ;
183+ var view = viewContainer . views [ i ] ;
184+ this . _viewDehydrateRecurse ( view ) ;
185+ this . _viewFactory . returnView ( view ) ;
184186 }
185187 viewContainer . clear ( ) ;
186188 }
Original file line number Diff line number Diff line change @@ -223,6 +223,17 @@ export function main() {
223223 expect ( viewFactory . spy ( 'returnView' ) ) . toHaveBeenCalledWith ( shadowView ) ;
224224 } ) ;
225225
226+ it ( 'should clear views in ViewContainers' , ( ) => {
227+ createAndHydrate ( null , null ) ;
228+ var vc = hostView . getOrCreateViewContainer ( 0 ) ;
229+ var childView = createEmptyView ( ) ;
230+ vc . insert ( childView ) ;
231+
232+ dehydrate ( hostView ) ;
233+
234+ expect ( viewFactory . spy ( 'returnView' ) ) . toHaveBeenCalledWith ( childView ) ;
235+ } ) ;
236+
226237 it ( 'should clear imperatively added child components' , ( ) => {
227238 var shadowView = createEmptyView ( ) ;
228239 createAndHydrate ( createProtoView ( ) , shadowView ) ;
You can’t perform that action at this time.
0 commit comments