diff --git a/src/ci_orchestrator/web/static/app.js b/src/ci_orchestrator/web/static/app.js index 7212718..d7a6041 100644 --- a/src/ci_orchestrator/web/static/app.js +++ b/src/ci_orchestrator/web/static/app.js @@ -241,6 +241,13 @@ document.body.addEventListener("htmx:afterSwap", function (evt) { var target = evt.detail && evt.detail.target; + if (!target || !target.isConnected) { + // eventInfo.target is the pre-swap node. Every polling card swaps + // outerHTML on itself, which detaches that exact node from the DOM -- + // detail.target is then a dead subtree forever. evt.target (the native + // dispatch target) is htmx's freshly-inserted element instead. + target = evt.target; + } if (target && target.id === "action-slot") { processSlot(target); }