AJAX on main thread, fix double-push in click delegation

- AJAX requests (SX-Request: true) now render on main thread instead
  of queueing behind slow full-page renders in worker pool
- Remove pushState from click handler — handle-history does it after
  swap succeeds, preventing double-push that triggered popstate handler

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 18:06:22 +00:00
parent 80931e4972
commit 5b55b75a9a
2 changed files with 25 additions and 10 deletions

View File

@@ -464,10 +464,8 @@
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
e.preventDefault();
var url = el.getAttribute("href") || el.getAttribute("sx-get");
// Push URL first (execute-request doesn't handle URL updates)
if (el.getAttribute("sx-push-url")) {
history.pushState({}, "", url);
}
// Don't push URL here — execute-request's handle-history does it.
// Double-push causes popstate handler to clobber the SX swap.
// Store the element reference for SX to pick up
window.__sxClickEl = el;
try {