Skip to content

Ignore responses for removed targets - #4129

Closed
jay23606 wants to merge 1 commit into
bigskysoftware:four-devfrom
jay23606:fix-ignore-removed-target-response
Closed

jay23606 wants to merge 1 commit 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).

@jay23606
jay23606 force-pushed the fix-ignore-removed-target-response branch from 1084d56 to 3bf49e5 Compare October 20, 2026 15:17
@MichaelWest22

Copy link
Copy Markdown
Collaborator

closing as i've merged my own fix for this now thanks

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.

2 participants