feat(x-search-field): opt-in debounce for input events#269
Merged
Conversation
A positive debounce attribute (milliseconds) coalesces rapid typing into a single x-search-field-input event fired once the user pauses, while local feedback like the clear button and validity stays synchronous. Absent or zero preserves the immediate per-keystroke behaviour, and a pending dispatch is cancelled on clear, reset, or disconnect.
1d870ea to
553e703
Compare
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.
Adds an opt-in
debounceattribute (and reflected numeric property) tox-search-field. When set to a positive millisecond count, rapid typing coalesces into a singlex-search-field-inputevent fired once the user pauses, carrying the field's final value. When the attribute is absent,0, or invalid, the component keeps its current immediate per-keystroke behaviour, so the change is fully backwards compatible.Only the outward
x-search-field-inputevent is delayed. Local feedback — the clear button, form value, and validity — stays synchronous with each keystroke so the field never feels laggy. A pending debounced dispatch is cancelled when the field is cleared, the parent form is reset, or the element is disconnected, so a stale event never lands after the value is gone. Thechange,search, andclearevents are never debounced.The debounce timer id is stored via
du/setv-untraced!as a transient, non-displayable handle (the documented pattern for opaque lifecycle handles), keeping the component stateless with no atom or volatile. Model parsing lives in a purenormalize-debounce. Covered by new model unit tests and integration tests for coalescing, cancel-on-clear, immediate-when-zero, and property reflection; docs and the demo gained a live debounce control with timestamped event logging. The framework adapter wrappers were regenerated to expose the new property.🤖 Generated with Claude Code