any ideas on how to add navigation in compose for ...
# compose-web
y
any ideas on how to add navigation in compose for web this code block works fine on desktop but on web it just bugs out
Copy code
@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 ?
a
Cc: @xxfast
K 1
Meantime just to clarify, what variant of Compose for Web you are using - JS HTML, JS Canvas or Wasm? And what is "bugs out"?
y
I am using the Compose Web that comes with Compose Wizard, by bugs out I mean it freezes I have a LaunchedEffect like so
Copy code
LaunchedEffect(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.
@Arkadii Ivanov any updates?
a
Decompose-Router is maintained by @xxfast. But from the provided information it's not clear what is the cause. Is there any chance for a reproducer?
loading freezes
This 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.