fix: abort timed-out requests with TimeoutError - #4045
Open
manwithacat wants to merge 1 commit into
Open
Conversation
Timeouts called AbortController.abort() with no reason, so hx-sync replace and request timeout were indistinguishable AbortErrors. Pass TimeoutError as the abort reason. Closes bigskysoftware#4021
manwithacat
added a commit
to manwithacat/htmx
that referenced
this pull request
Sep 7, 2026
Before/after iframes against 7f9160f for PRs bigskysoftware#4043 bigskysoftware#4044 bigskysoftware#4045.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Request timeouts called
AbortController.abort()with no reason, so a timeout and anhx-syncreplace were bothAbortError. PassTimeoutError("Request timed out") as the abort reason so apps can tell them apart viactx.request.signal.reason.Corresponding issue: #4021
Demo: https://manwithacat.github.io/htmx/demos/timeout-error-reason/
Testing
Existing timeout test now asserts
signal.reason.name === 'TimeoutError'. Added a replace-abort case that is notTimeoutError. Documented the discriminator onhtmx:error.Local
npm test(Chromium, same as CIhtmx_tests): 87 files, 1739 passed, 0 failed, 5 skipped.Checklist
four-dev__issueRequestunit tests cover timeout vs replace