@Composable
fun PlacesSearch(
currentlySearchedPlaces: List<PlaceEntity>,
onItemBookmarkClicked: (PlaceEntity) -> Unit,
onPlaceSearched: (PlaceEntity) -> Unit,
onPlaceClicked: (PlaceEntity) -> Unit,
) {
if (currentlySearchedPlaces.isNotEmpty()) {
Log.e("Searched places", "$currentlySearchedPlaces")
RulonaSearchList(
places = currentlySearchedPlaces,
onItemClick = { uuid ->
onPlaceClicked(uuid)
onPlaceSearched(uuid)
},
onItemBookmarkClicked = {
onItemBookmarkClicked(it)
},
)
}
}
@Composable
fun RulonaSearchList(
places: List<PlaceEntity>,
onItemClick: (PlaceEntity) -> Unit,
onItemBookmarkClicked: (PlaceEntity) -> Unit,
) {
Log.e("rendering places", "$places")
LazyColumn {
items(places) { place ->
Log.e("item in list", "$place")
RulonaSearchItem(
title = place.name,
isBookmarked = place.isBookmarked,
onClick = { onItemClick(place) },
onBookmarkClicked = { onItemBookmarkClicked(place) },
)
}
}
}
As you can see in the logs, the items correctly update with the new bookmarked state but the "item in list" log is not called again, which means that the SearchItem does not recompose inside the list