fix(ivy): ViewRef.detachFromAppRef should clean the DOM (#29159)
PR Close #29159
This commit is contained in:

committed by
Kara Erickson

parent
29f57e315e
commit
eccbc785b3
@ -243,6 +243,15 @@ export function addRemoveViewFromContainer(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach a `LView` from the DOM by detaching its nodes.
|
||||
*
|
||||
* @param lView the `LView` to be detached.
|
||||
*/
|
||||
export function renderDetachView(lView: LView) {
|
||||
walkTNodeTree(lView, WalkTNodeTreeAction.Detach, lView[RENDERER], null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverses down and up the tree of views and containers to remove listeners and
|
||||
* call onDestroy callbacks.
|
||||
|
@ -14,7 +14,7 @@ import {EmbeddedViewRef as viewEngine_EmbeddedViewRef, InternalViewRef as viewEn
|
||||
import {checkNoChangesInRootView, checkNoChangesInternal, detectChangesInRootView, detectChangesInternal, markViewDirty, storeCleanupFn} from './instructions';
|
||||
import {TElementNode, TNode, TNodeType, TViewNode} from './interfaces/node';
|
||||
import {FLAGS, HOST, LView, LViewFlags, T_HOST} from './interfaces/view';
|
||||
import {destroyLView} from './node_manipulation';
|
||||
import {destroyLView, renderDetachView} from './node_manipulation';
|
||||
import {findComponentView, getLViewParent} from './util/view_traversal_utils';
|
||||
import {getNativeByTNode} from './util/view_utils';
|
||||
|
||||
@ -262,7 +262,10 @@ export class ViewRef<T> implements viewEngine_EmbeddedViewRef<T>, viewEngine_Int
|
||||
this._viewContainerRef = vcRef;
|
||||
}
|
||||
|
||||
detachFromAppRef() { this._appRef = null; }
|
||||
detachFromAppRef() {
|
||||
this._appRef = null;
|
||||
renderDetachView(this._lView);
|
||||
}
|
||||
|
||||
attachToAppRef(appRef: ApplicationRef) {
|
||||
if (this._viewContainerRef) {
|
||||
|
Reference in New Issue
Block a user