From 134c9e54e09cc970e20e8aa99299ef2d23ed3040 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Thu, 4 Jun 2026 11:18:30 -0700 Subject: [PATCH] fix: improve view teardown process for reusable views --- packages/core/ui/core/view-base/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/ui/core/view-base/index.ts b/packages/core/ui/core/view-base/index.ts index 0e3212755e..5028125779 100644 --- a/packages/core/ui/core/view-base/index.ts +++ b/packages/core/ui/core/view-base/index.ts @@ -1264,7 +1264,7 @@ export abstract class ViewBase extends Observable { */ public destroyNode(forceDestroyChildren?: boolean): void { this.reusable = false; - this.callUnloaded(); + this.unloadView(this); this._tearDownUI(forceDestroyChildren); } @@ -1284,7 +1284,9 @@ export abstract class ViewBase extends Observable { if (!preserveNativeView) { this.eachChild((child) => { - child._tearDownUI(force); + // if we decided to tear down the current view, we should also tear down the children, even if they are reusable + // the developer is responsible to detach them if they need to reuse them somewhere else + child._tearDownUI(true); return true; });