When search field becomes empty, show the contact list from the beginning

This commit is contained in:
Juha Heinanen
2026-01-05 04:39:09 +02:00
parent 666c72cf74
commit 79837a680a

View File

@ -70,6 +70,7 @@ import com.tutpro.baresip.CustomElements.verticalScrollbar
import java.io.File
import java.io.IOException
import androidx.compose.material.icons.filled.Search
import androidx.compose.runtime.LaunchedEffect
const val avatarSize: Int = 96
@ -232,6 +233,12 @@ private fun ContactsContent(
val lazyListState = rememberLazyListState()
LaunchedEffect(searchQuery) {
if (searchQuery.isBlank()) {
lazyListState.scrollToItem(0)
}
}
val filteredContacts = remember(BaresipService.contacts, searchQuery) {
if (searchQuery.isBlank()) {
BaresipService.contacts