Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

fix: improve dynamic header management to prevent infinite loops

Muhammad Hamza Khana178ac0372d1
diff --git a/packages/app/src/builder-ui/ui/forms/dynamic-headers.ts b/packages/app/src/builder-ui/ui/forms/dynamic-headers.ts
index f68f8a80..c23611a0 100644
--- a/packages/app/src/builder-ui/ui/forms/dynamic-headers.ts
+++ b/packages/app/src/builder-ui/ui/forms/dynamic-headers.ts
@@ -434,6 +434,13 @@ export class DynamicHeaders {
private manageResponsiveTabs(): void {
if (!this.container || !this.nav) return;
+ // Early exit if container is not visible (e.g., sidebar closed)
+ // This prevents infinite retry loops when the component is hidden
+ const containerWidth = this.container.getBoundingClientRect().width;
+ if (containerWidth === 0 || this.container.offsetParent === null) {
+ return;
+ }
+
// Check if already running to prevent concurrent execution
if (this.isRunning) {
this.isPending = true;
@@ -507,8 +514,11 @@ export class DynamicHeaders {
// Force reflows and check if tabs have rendered widths - retry if not
(void this.container.offsetHeight, void this.nav.offsetHeight);
if (sortedTabs.some((tab) => tab.offsetWidth === 0 && this.nav?.contains(tab))) {
- handleEarlyReturn();
- setTimeout(() => this.manageResponsiveTabs(), 50);
+ // Only retry if container is still visible; avoids infinite loop when hidden
+ this.isRunning = false;
+ if (this.container.getBoundingClientRect().width > 0) {
+ setTimeout(() => this.manageResponsiveTabs(), 50);
+ }
return;
}