Fix IPs page race between auto-refresh polling and action buttons
The 5s auto-poll (hx-trigger="every Ns" on #ips-table-wrap) and every button/form that also swaps #ips-table-wrap (bulk recheck/delete/clear, per-row recheck/cancel/delete, the add-address form) each fired independent, uncoordinated htmx requests against the same target. With no hx-sync, whichever response landed last won — including a poll's in-flight GET landing *after* a slower mutation's own response and silently reverting the just-applied change with stale data. This matched every symptom reported: buttons needing several clicks before they "took", "Перепроверить выбранные" appearing to do nothing with many rows selected (more DB writes -> wider race window for a poll to land after and clobber it), the page "blinking" back to a stale queued state a few seconds after a bulk recheck actually succeeded, and auto-refresh working "every other time". Every element that targets #ips-table-wrap now shares hx-sync="#ips-table-wrap:queue last", so at most one request affecting it is ever in flight: a trigger that fires while another is pending gets queued (never aborted mid-write) and only the most recent queued trigger actually runs once the current one finishes, guaranteeing responses are always applied in the order they actually resolve. Rebuilt bin/admin-dashboard (only internal/dashboard changed) and bin/SHA256SUMS per docs/SETUP.md's documented build recipe. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e0bcb6af1
commit
5a53705217
4 files changed
+24
-10
No files matched your search
Binary file not shown.
Reference in new issue
Block a user