Colton Idle
05/04/2025, 8:08 PM@Composable
fun InstrumentsList() {
var instruments by remember { mutableStateOf<List<Instrument>>(listOf()) }
LaunchedEffect(Unit) {
withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
instruments = supabase.from("instruments")
.select().decodeList<Instrument>()
}
}
Could you just move the work from the LaunchedEffect to the remember {}.block?MR3Y
05/04/2025, 8:11 PMproduceState
?
https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#produceState(kotlin.Any,kotlin.coroutines.SuspendFunction1)MR3Y
05/04/2025, 8:12 PMvar instruments by produceState(listOf()) {
withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
instruments = supabase.from("instruments")
.select().decodeList<Instrument>()
}
}
ephemient
05/04/2025, 8:13 PMsuspend
in remember
Francesc
05/04/2025, 8:36 PMColton Idle
05/04/2025, 9:02 PMFrancesc
05/04/2025, 9:36 PMColton Idle
05/04/2025, 9:44 PMChrimaeon
05/04/2025, 10:06 PMChrimaeon
05/04/2025, 10:08 PMFrancesc
05/04/2025, 10:10 PMChrimaeon
05/04/2025, 10:10 PMFrancesc
05/04/2025, 10:11 PMChrimaeon
05/04/2025, 10:11 PMFrancesc
05/04/2025, 10:11 PMChrimaeon
05/04/2025, 10:12 PMFrancesc
05/04/2025, 10:12 PMChrimaeon
05/04/2025, 10:12 PMFrancesc
05/04/2025, 10:13 PMChrimaeon
05/04/2025, 10:13 PM