Properly notify parents when SearchBarWithAutoCompletion text field text is cleared

This commit is contained in:
Nebojsa Vuksic 2025-08-01 12:53:39 +02:00
parent cb6c908769
commit edb8fb0b28

View File

@ -58,6 +58,10 @@ internal fun <T> SearchBarWithAutoCompletion(
snapshotFlow { textFieldState.text.toString() }
.distinctUntilChanged()
.collect { searchTerm ->
if (searchTerm.isEmpty()) {
onClear()
}
popupController.onQueryChanged(searchTerm)
}
}
@ -81,7 +85,6 @@ internal fun <T> SearchBarWithAutoCompletion(
trailingIcon = {
if (!isInputFieldEmpty) {
CloseIconButton {
onClear()
textFieldState.setTextAndPlaceCursorAtEnd("")
}
}