``` var startBluetoothFlow by remember { mutabl...
# compose
m
Copy code
var startBluetoothFlow by remember { mutableStateOf(false) }
    LaunchedEffect(key1 = true) {
        if (!host.bleManager.isReadyForScanning) {
            startBluetoothFlow = true
        }
    }

    if (startBluetoothFlow) {
        BluetoothController(
            permissionState = permissionState,
            bluetooth = host.bleManager,
            navHostController = navController,
        )
    }
The problem is that BluetoothController is getting evaluated multiple times
I feel like permissionState is triggering recomposition even when it’s not actually changing state
f
once you turn the flag to
true
, it will remain
true
and trigger your
if
block at each composition. You could wrap your
if
block in a
LaunchedEffect
with
key
startBluetothFlow
or maybe just move this block into the existing
LaunchedEffect
m
well, i can’t move the block inside LaunchedEffect, because BluetoothController is a composable. I think my issue was with using SideEffect in the BluetoothController to trigger things. I switched to using LaunchedEffect in there so that things only fire a single time.