#1921·agent-zero

WebUI: a failed component import leaves its .loading placeholder in the DOM forever

Author: OlszalsikCreated Sep 26, 2026Updated Sep 26, 2026

Summary

When importComponent throws, the loading placeholder it inserted is never removed, so the component stays a spinner for the life of the page. There is no error UI and no retry — the element is simply stuck.

Where

webui/js/components.js:

  • :30 — targetElement.innerHTML = '<div class="loading"></div>'
  • :174-176 — the placeholder is removed only on the success path
  • :185-187 — catch logs and re-raises, with no cleanup
  • :186-189 — finally only does importLocks.delete(lockKey)

So the cleanup is on the happy path only. A rejected dynamic import, a 404 on a component asset, or a syntax error in the component leaves the spinner up indefinitely.

Repro

Any component whose import fails. For example, temporarily point one <x-component path=...> at a non-existent asset, or reject the network request in DevTools, then reload. The component renders as a permanent .loading div.

Why it matters

It is indistinguishable from a slow load, so users (and anything watching the DOM) read it as "still working". A plugin that wants to recover has to guess at a timeout and then remove nodes it does not own — which is how a plugin built to fix this ended up deleting <x-extension> breakpoints from the DOM.

Suggested fix

Move the removal into the finally that already exists, so it runs on both paths:

javascript
} finally {
  importLocks.delete(lockKey);
  const loadingEl = targetElement.querySelector(':scope > .loading');
  if (loadingEl) targetElement.removeChild(loadingEl);
}

Optionally render an error state in its place so the failure is visible.

Note on history

bf2046ff ("Prevent WebUI extension loading stalls") included "Always clear component loading placeholders after failures", and 9e2a1b63 reverted that commit along with the request-queue change. If the revert was aimed at the queueing and not at the placeholder cleanup, this part may be safe to restore on its own.

Verified against components.js at the current main.