fix: use htmx.trigger instead of dispatchEvent for HTMX swap

dispatchEvent(submit) was triggering native form submission (full page
reload). htmx.trigger() properly triggers HTMX swap.

Also re-enable initial rebindEventLayers so polygons load on first render.
This commit is contained in:
Matt Johnson 2026-05-18 18:55:56 +00:00
commit a7bdb005f4

View file

@ -239,9 +239,7 @@
southInput.value = bounds.getSouth().toFixed(4);
eastInput.value = bounds.getEast().toFixed(4);
westInput.value = bounds.getWest().toFixed(4);
document.getElementById("filter-form").dispatchEvent(
new Event("submit", { bubbles: true })
);
htmx.trigger(document.getElementById("filter-form"), "submit");
}
function buildPopup(row) {
@ -417,7 +415,7 @@
document.getElementById("fit-to-results").addEventListener("click", fitToAllLayers);
// Initial load - bind layers and fit bounds
// rebindEventLayers(); // DISABLED: map shows all events, only table filters
rebindEventLayers(); // Initial load only
if (false) { // DISABLED: map never auto-fits
fitToAllLayers();
isInitialLoad = false;