I'm using `launchInComposition` as shown here to c...
# compose
j
I'm using
launchInComposition
as shown here to call suspend function....what's recommended way to show progress indicator (like
CircularProgressIndicator
) until that function completes?
Copy code
@Composable
fun MainLayout(sdk: SpaceXSDK) {
    var launches by remember { mutableStateOf<List<RocketLaunch>>(emptyList()) }

    launchInComposition {
        launches = sdk.getLaunches(false)
    }
    
    LazyColumnFor(items = launches) { launch ->
        LaunchView(launch)
    }
}
actually looks like
JetNews
sample has something very similar to what I need (with their
launchUiStateProducer
)
👍 1
h
if you are looking for a really simple solution, you can always add a
remember { mutableStateOf(true) }
and update that state once your calculation is completed in
launchInComposition
👍 1
something like
Copy code
var isLoading by remember { mutableStateOf(true) }

launchInComposition { 
   ...
   isLoading = false
}

if(isLoading) {
    CircularProgressIndicator()
}
☝️ 1