Skip to content

prevent abort exception on sse close event - #4081

Open
MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:sse-handle-abort
Open

MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:sse-handle-abort

Conversation

@MichaelWest22

@MichaelWest22 MichaelWest22 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Description

When hx-sse:close receives its configured event, the cleanup code aborts the fetch controller while parseSSE is still suspended on reader.read(), causing the browser to reject that pending read with an AbortError that has no handler. The fix cancels the reader first so parseSSE exits cleanly before the abort fires.

Corresponding issue:
#4078

Testing

Added tests

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@MichaelWest22 MichaelWest22 added bug Something isn't working htmx 4 Issues specific to htmx version 4 labels Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant