Skip to content

Ignore responses for removed targets - #4129

Open
jay23606 wants to merge 2 commits into
bigskysoftware:four-devfrom
jay23606:fix-ignore-removed-target-response
Open

jay23606 wants to merge 2 commits into
bigskysoftware:four-devfrom
jay23606:fix-ignore-removed-target-response

Conversation

@jay23606

@jay23606 jay23606 commented Oct 9, 2026

Copy link
Copy Markdown

When a request target is removed while its request is pending, the eventual response should not affect the current page. At present, htmx can still process its title and hx-head changes even though the target is detached.

Record whether the target is connected when the request starts, then discard the response if that target was removed before the response arrives. The guard runs before htmx:before:response, preventing response extensions from applying stale page-level effects while preserving requests that begin with a detached target.

Fixes #4101.

Validation: npm run test:chrome -- --files test/tests/unit/ajax.js (29 passed, 0 failed, 1 skipped).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant