Skip to content

Commit 2b4918b

Browse files
committed
[ch-combo-box-render] Fix emitting the value with debounce, even when the selection is confirmed with filters
1 parent fa9f793 commit 2b4918b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/combo-box/combo-box.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,16 @@ export class ChComboBoxRender
568568

569569
// No item was selected and the suggest is not strict
570570
if (!this.suggestOptions?.strict) {
571-
// TODO: Should we update the #lastConfirmedValue?
571+
// TODO: Add a unit test: filters, no strict, value confirmation with
572+
// Enter or Tab. Expected: The value update should not be debounced
573+
// TODO: Avoid emitting duplicated input events if the value did not
574+
// changed
575+
576+
// Clear last debounce and update the value right away, because the value
577+
// selection was confirmed
578+
clearTimeout(this.#queuedInputValueUpdate);
579+
this.value = this.#inputRef.value;
580+
this.input.emit(this.value);
572581

573582
// TODO: Add a unit test for this
574583
this.#emitChangeEvent();

0 commit comments

Comments
 (0)