fix(ivy): attached flag not being reset when view is destroyed (#29064)
Currently we only reset the `Attached` flag of a view if it is detached through its parent, however this means that if a root view is destroyed, its flag will never be reset. This manifested itself in one of the Material tests where we were destroying the root view. This PR resolves FW-1130. PR Close #29064
This commit is contained in:

committed by
Andrew Kushnir

parent
a06824aef6
commit
c0757d1d44
@ -426,6 +426,10 @@ function cleanUpView(viewOrContainer: LView | LContainer): void {
|
||||
if ((viewOrContainer as LView).length >= HEADER_OFFSET) {
|
||||
const view = viewOrContainer as LView;
|
||||
|
||||
// Usually the Attached flag is removed when the view is detached from its parent, however
|
||||
// if it's a root view, the flag won't be unset hence why we're also removing on destroy.
|
||||
view[FLAGS] &= ~LViewFlags.Attached;
|
||||
|
||||
// Mark the LView as destroyed *before* executing the onDestroy hooks. An onDestroy hook
|
||||
// runs arbitrary user code, which could include its own `viewRef.destroy()` (or similar). If
|
||||
// We don't flag the view as destroyed before the hooks, this could lead to an infinite loop.
|
||||
|
Reference in New Issue
Block a user