# HTMX/destroy race hypothesis — investigation report ## HTMX destroy triggers ### What fires `destroy()` and when, relative to HTMX swap lifecycle The only code path that destroys FilePond instances is `destroyFilePondsIn(el)`, called by the `htmx:beforeSwap` listener: ```js window.htmx.on("htmx:beforeSwap", onHtmxBeforeSwap); // → onHtmxBeforeSwap(evt) { destroyFilePondsIn(evt.detail.target); } ``` On the **edit page** (`/admin/edit.php`), the following HTMX targets exist on page load: | Element | Trigger | Target selector | Scope | |---------|---------|-----------------|-------| | `#toast-region` | `load` | `#toast-region` | Footer `