Skip to content

Commit 98a2da8

Browse files
committed
fix calling a flow operator directly inside a composable
1 parent 1e4e6c2 commit 98a2da8

File tree

1 file changed

+4
-1
lines changed
  • app/src/main/java/com/uravgcode/chooser/navigation/presentation

1 file changed

+4
-1
lines changed

app/src/main/java/com/uravgcode/chooser/navigation/presentation/Navigation.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import androidx.compose.animation.scaleOut
2323
import androidx.compose.foundation.background
2424
import androidx.compose.runtime.Composable
2525
import androidx.compose.runtime.getValue
26+
import androidx.compose.runtime.remember
2627
import androidx.compose.runtime.rememberCoroutineScope
2728
import androidx.compose.ui.Modifier
2829
import androidx.compose.ui.graphics.Color
@@ -47,7 +48,8 @@ fun Navigation(
4748
val navController = rememberNavController()
4849
val coroutineScope = rememberCoroutineScope()
4950

50-
val hasSeenTutorial by dataStore.data.map { it.hasSeenTutorial }.collectAsStateWithLifecycle(initialValue = true)
51+
val hasSeenTutorialFlow = remember { dataStore.data.map { it.hasSeenTutorial } }
52+
val hasSeenTutorial by hasSeenTutorialFlow.collectAsStateWithLifecycle(initialValue = true)
5153
val startDestination = if (hasSeenTutorial) Screen.Chooser else Screen.Tutorial
5254

5355
val context = LocalContext.current
@@ -90,3 +92,4 @@ fun Navigation(
9092
}
9193
}
9294
}
95+

0 commit comments

Comments
 (0)