Repository navigation
improve support for multiple changed triggers on same element - #4096
Open
MichaelWest22 wants to merge 1 commit into
Open
MichaelWest22 wants to merge 1 commit into
MichaelWest22 wants to merge 1 commit into
Conversation
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
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
masterfor website changes,devforsource changes)
approved via an issue
npm run test) and verified that it succeeded