I have a PagingData flow that will be a combinati...
# compose-android
h
I have a PagingData flow that will be a combination from
PagingData<Model>
and a
Flow<Boolean>
and result in PagingData<UiModel>, and finally show up in a LazyColumn via
collectAsLazyPagingItems()
. In
LazyColumn
:
Copy code
val assetPagingData = viewModel.pagingFlow.collectAsLazyPagingItems()
...
items(
    count = assetPagingData.itemCount,
    key = assetPagingData.itemKey { it.id }) {
    val item = assetPagingData[it]
    if (item != null) {
        AssetItem(item = item) {
        }
    } else {
        Text(text = "Item null")
    }
}
In `ViewModel`:
Copy code
pagingFlow = getDataUseCase.execute(param)
    .combine(masterDataModelStateFlow) { pagingData, masterDataModel ->
        pagingData.map { pagingModel ->
            UiModel(
                pagingModel = pagingModel,
                masterDataModel = masterDataModel,
            )
        }
    }.combine(getVisibilityFlow) { uiModel, show ->
        uiModel.map {
            it.copy(showBalance = show)
        }
    }.cachedIn(coroutineScope)
After I change the Boolean value, it triggered
combine()
again, I expected that mapping
PagingData<Model>
one more time to get new
PagingData<UiModel>
but it does not recompose the
LazyColumn
to get new UI available. What did I miss? Thanks.