youssef
01/02/2024, 12:22 PM@OptIn(ExperimentalDecomposeApi::class)
@Composable
fun RouterScreen() {
val router: Router<RouterStateModels> = rememberRouter(RouterStateModels::class) { listOf(Auth) }
RoutedContent(
router = router,
animation = predictiveBackAnimation(
backHandler = LocalRouterContext.current.backHandler,
onBack = { router.pop() },
animation = stackAnimation(slide())
),
) { screen ->
when (screen) {
Auth -> {
AuthScreen(
navigateToHome = {
//Pass the satate of the session to the home screen
router.push(Home)
}
)
}
is Home -> {
HomeScreen()
}
}
}
}
any ideas on how to solve this ?Arkadii Ivanov
01/02/2024, 1:21 PMArkadii Ivanov
01/02/2024, 2:12 PMyoussef
01/02/2024, 2:19 PMLaunchedEffect(state.isSuccess) {
if (state.isSuccess){
//delay is added to prevent crash
delay(1)
navigateToHome.invoke()
}
}
when the state is successful there is a CircularProgressIndicator for 1ms and then it navigates to home. at least that's what's supposed to happen but the loading freezes and the app freezes with no errors i also added that delay of 1 ms because if I don't it crashes on both desktop and web.youssef
01/03/2024, 11:06 AMArkadii Ivanov
01/03/2024, 11:09 AMArkadii Ivanov
01/03/2024, 11:10 AMloading freezesThis suggests that there is a general issue in the app. Might be a deadlock due to the single-threaded JS environment, or something like that.