Skip to content

improve support for multiple changed triggers on same element - #4096

Open
MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:changed-ordering
Open

MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:changed-ordering

Conversation

@MichaelWest22

Copy link
Copy Markdown
Collaborator

Description

someone on discord reported that "input changed delay:1s, blur changed" does not work as expected as the blur triggers followed by the delayed input one so you get two requests. The issue is changed is tracked per spec when ideally it should be tracked per element so two changed trigger specs can work together properly and not double send requests. Also found that changed blocks the trigger up front before it does the delay etc which also breaks it here as the changed from the delayed input action updates the weakmap current value of the input which then stops the blur changed trigger firing early as intended.

To fix this we just need to move to storing the weakmap on the htmx element shared state instead. And move the changed to checking to the inner loop after the delay which now allows independent delays to not block changed requests.

Corresponding issue:

Testing

Added basic 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 the htmx 4 Issues specific to htmx version 4 label Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant