From d7a49a4198a9351e6d713743a5d8db7076c5fa13 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Tue, 19 May 2026 10:23:53 -0300 Subject: [PATCH] fix(core): prevent exponential traversal in _dialogClosed and _onRootViewReset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both methods used eachDescendant to walk the full subtree, then each visited child recursively called the same method—which walked its own subtree again. For a tree of depth n this produced O(2^n) visits. Replace eachDescendant with eachChild so each node is visited exactly once via natural recursion, reducing traversal to O(n). --- packages/core/ui/core/view-base/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/ui/core/view-base/index.ts b/packages/core/ui/core/view-base/index.ts index e4b2cd051e..41802e5bc2 100644 --- a/packages/core/ui/core/view-base/index.ts +++ b/packages/core/ui/core/view-base/index.ts @@ -1502,7 +1502,7 @@ export abstract class ViewBase extends Observable { * Method is intended to be overridden by inheritors and used as "protected" */ public _dialogClosed(): void { - eachDescendant(this, (child: ViewBase) => { + this.eachChild((child: ViewBase) => { child._dialogClosed(); return true; @@ -1513,7 +1513,7 @@ export abstract class ViewBase extends Observable { * Method is intended to be overridden by inheritors and used as "protected" */ public _onRootViewReset(): void { - eachDescendant(this, (child: ViewBase) => { + this.eachChild((child: ViewBase) => { child._onRootViewReset(); return true;