Skip to content

Commit

Permalink
fix: avoid keyword being the selection
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Nov 25, 2024
1 parent 586825d commit 5b41632
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,11 @@ export class AutocompleteComponent
)
)

const externalValueChange$ = this.control.valueChanges.pipe(
filter((value) => typeof value === 'object' && value.title),
map((item) => item.title)
)

// this observable emits arrays of suggestions loaded using the given action
const suggestionsFromAction = merge(
newValue$.pipe(
filter((value: string) => value.length >= this.minCharacterCount)
),
externalValueChange$
)
).pipe(
tap(() => {
this.searching = true
Expand Down Expand Up @@ -242,6 +236,7 @@ export class AutocompleteComponent
}
if (this.clearOnSelection) {
this.inputRef.nativeElement.value = ''
this.inputCleared.emit()
}
}
}

0 comments on commit 5b41632

Please sign in to comment.