Agent Zero AI framework
fix: defer DOM insertion until module imports resolve in component loader
Alessandro37d94433246e
diff --git a/webui/js/components.js b/webui/js/components.jsindex 282a7a9f4..c9ff2a357 100644--- a/webui/js/components.js+++ b/webui/js/components.js@@ -57,6 +57,7 @@ export async function importComponent(path, targetElement) {];const loadPromises = [];+ const deferredNodes = [];let blobCounter = 0;for (const node of allNodes) {@@ -156,14 +157,17 @@ export async function importComponent(path, targetElement) {targetElement.appendChild(clone);} else {- const clone = node.cloneNode(true);- targetElement.appendChild(clone);+ deferredNodes.push(node.cloneNode(true));}}// Wait for all tracked external scripts/styles to finish loadingawait Promise.all(loadPromises);+ for (const deferred of deferredNodes) {+ targetElement.appendChild(deferred);+ }+// Remove loading indicatorconst loadingEl = targetElement.querySelector(':scope > .loading');if (loadingEl) {