.collectAsLazyPagingItems() recomposing composable

PressRex profile image
by PressRex
.collectAsLazyPagingItems() recomposing composable

On using .collectAsLazyPagingItems() on a data type of Flow<PagingData<..>>.

It cannot stop the composable from recomposing one extra time.

Any solution or am I doing something fundamentally wrong

data class UIState(
val data: Flow<PagingData<..>>
)

# inViewmodel
_uiState = MutableStateFlow(UiState())
uiState = StateFlow<UIState> = _uiState.asStateFlow()

#in composable
@Composable
fun Container(){
//INIT LAUNCHED EFFECT

Screen(uiState=...,onstateEvent=..)

}

@Composable
fun Screen(
..
..
){
val data = state.scans.collectAsLazyPagingItems()
}



Source: View source

PressRex profile image
by PressRex

Subscribe to New Posts

Lorem ultrices malesuada sapien amet pulvinar quis. Feugiat etiam ullamcorper pharetra vitae nibh enim vel.

Success! Now Check Your Email

To complete Subscribe, click the confirmation link in your inbox. If it doesn’t arrive within 3 minutes, check your spam folder.

Ok, Thanks

Read More