Skip to content

feat(x-search-field): opt-in debounce for input events#269

Merged
avanelsas merged 1 commit into
mainfrom
feat/x-search-field-debounce
Jul 14, 2026
Merged

feat(x-search-field): opt-in debounce for input events#269
avanelsas merged 1 commit into
mainfrom
feat/x-search-field-debounce

Conversation

@avanelsas

Copy link
Copy Markdown
Owner

Adds an opt-in debounce attribute (and reflected numeric property) to x-search-field. When set to a positive millisecond count, rapid typing coalesces into a single x-search-field-input event 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-input event 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. The change, search, and clear events 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 pure normalize-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

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.
@avanelsas avanelsas force-pushed the feat/x-search-field-debounce branch from 1d870ea to 553e703 Compare July 14, 2026 11:10
@avanelsas avanelsas merged commit 0c6e9f5 into main Jul 14, 2026
1 check passed
@avanelsas avanelsas deleted the feat/x-search-field-debounce branch July 14, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant