Guilherme Delgado
01/10/2023, 1:37 PMcontainerHost.intent {
reduce { state.copy(...) }
reduce { state.copy(...) }
}
}
is there any way I can assure that the second reduce happens after the first one?
Use case: Iām doing an āundoā swipe to dismiss. The androidx.compose.material.SwipeToDismiss
removes/hides the item from the UI (LazyColumn
) before removing it from the UIState.
Therefore we need to simulate that removal from the UIState by emitting a new one without the item, and then, we emit a new state again with the item back in the list.
My question appears because I can only succeed if I do something like:
fun undoDelete(id: Long) {
containerHost.intent {
val last = state.clients.toList()
reduce { state.copy(clients = state.clients.filterNot { it.id == id }.toList()) }
delay(50)
reduce { state.copy(clients = last) }
}
}
but it feels like šØ š
Mikolaj Leszczynski
01/10/2023, 3:19 PMStateFlow
?Mikolaj Leszczynski
01/10/2023, 3:20 PMblockingIntent
Guilherme Delgado
01/10/2023, 3:20 PMMikolaj Leszczynski
01/10/2023, 3:20 PMGuilherme Delgado
01/10/2023, 3:20 PMMikolaj Leszczynski
01/10/2023, 3:20 PMblockingIntent
, if it doesn't help then it's likely the conflation that's the problemMikolaj Leszczynski
01/10/2023, 3:21 PMGuilherme Delgado
01/10/2023, 3:36 PMblockingIntent
?Guilherme Delgado
01/10/2023, 3:36 PMcontainerHost.blockingIntent
?Guilherme Delgado
01/10/2023, 3:36 PMMikolaj Leszczynski
01/10/2023, 3:36 PMGuilherme Delgado
01/10/2023, 3:37 PMorbitMviCore = "4.4.0"
Guilherme Delgado
01/10/2023, 3:37 PMGuilherme Delgado
01/10/2023, 3:38 PMGuilherme Delgado
01/10/2023, 3:38 PMGuilherme Delgado
01/10/2023, 3:51 PMblockingIntent
by itself didnāt solvedMikolaj Leszczynski
01/10/2023, 3:56 PM