title: JetpackCompose Navigation Nested Graphs cause "ViewModelStore should be set before setGraph call" exception
body: <p>I am trying to apply Jetpack Compose navigation into my application.</p>
  <p>My Screens: Login/Register screens and Bottom navbar screens(call, chat, settings).</p>
  <p>I already found out that the best way to do this is using nested graphs.</p>
  <p>But I keep getting <code>ViewModelStore should be set before setGraph call</code> exception. However, I don't think this is the right exception.</p>
  <p>My navigation is already in the latest version. Probably my nested graph logic is not right.</p>
  <p>Requirement:
  I want to be able to navigate from the Login or Register screen to any BottomBar Screen &amp; reverse</p>
  <pre><code>@Composable
  fun SetupNavGraph(
      navController: NavHostController,
      userViewModel: UserViewModel
  ) {
      NavHost(
          navController = navController,
          startDestination = BOTTOM_BAR_GRAPH_ROUTE,
          route = ROOT_GRAPH_ROUTE
      ) {
          loginNavGraph(navController = navController, userViewModel)
          bottomBarNavGraph(navController = navController, userViewModel)
      }
  }
  </code></pre>
  <p>NavGraph.kt</p>
  <pre><code>fun NavGraphBuilder.loginNavGraph(
      navController: NavHostController,
      userViewModel: UserViewModel
  ) {
      navigation(
          startDestination = Screen.LoginScreen.route,
          route = LOGIN_GRAPH_ROUTE
      ) {
          composable(
              route = Screen.LoginScreen.route,
              content = {
                  LoginScreen(
                      navController = navController,
                      loginViewModel = userViewModel
                  )
              })
          composable(
              route = Screen.RegisterScreen.route,
              content = {
                  RegisterScreen(
                      navController = navController,
                      loginViewModel = userViewModel
                  )
              })
      }
  }
  </code></pre>
  <p>LoginNavGraph.kt</p>
  <pre><code>fun NavGraphBuilder.bottomBarNavGraph(
      navController: NavHostController,
      userViewModel: UserViewModel
  ) {
      navigation(
          startDestination = Screen.AppScaffold.route,
          route = BOTTOM_BAR_GRAPH_ROUTE
      ) {
          composable(
              route = Screen.AppScaffold.route,
              content = {
                  AppScaffold(
                      navController = navController,
                      userViewModel = userViewModel
                  )
              })
      }
  }
  </code></pre>
  <p>BottomBarNavGraph.kt</p>
  <pre><code>@Composable
  fun AppScaffold(
      navController: NavHostController,
      userViewModel: UserViewModel
  ) {
      val scaffoldState = rememberScaffoldState()
  
      Scaffold(
  
          bottomBar = {
              BottomBar(mainNavController = navController)
          },
          scaffoldState = scaffoldState,
  
          ) {
  
          NavHost(
              navController = navController,
              startDestination = NavigationScreen.EmergencyCallScreen.route
          ) {
              composable(NavigationScreen.EmergencyCallScreen.route) {
                  EmergencyCallScreen(
                      navController = navController,
                      loginViewModel = userViewModel
                  )
              }
              composable(NavigationScreen.ChatScreen.route) { ChatScreen() }
              composable(NavigationScreen.SettingsScreen.route) {
                  SettingsScreen(
                      navController = navController,
                      loginViewModel = userViewModel
                  )
              }
          }
      }
  }
  </code></pre>
  <p>AppScaffold.kt</p>
  <pre><code>@Composable
  fun BottomBar(mainNavController: NavHostController) {
  
      val items = listOf(
          NavigationScreen.EmergencyCallScreen,
          NavigationScreen.ChatScreen,
          NavigationScreen.SettingsScreen,
      )
  
      BottomNavigation(
          elevation = 5.dp,
      ) {
          val navBackStackEntry by mainNavController.currentBackStackEntryAsState()
          val currentRoute = navBackStackEntry?.destination?.route
          items.map {
              BottomNavigationItem(
                  icon = {
                      Icon(
                          painter = painterResource(id = it.icon),
                          contentDescription = it.title
                      )
                  },
                  label = {
                      Text(
                          text = it.title
                      )
                  },
                  selected = currentRoute == it.route,
                  selectedContentColor = Color.White,
                  unselectedContentColor = Color.White.copy(alpha = 0.4f),
                  onClick = {
                      mainNavController.navigate(it.route) {
                          mainNavController.graph.startDestinationRoute?.let { route -&gt;
                              popUpTo(route) {
                                  saveState = true
                              }
                          }
                          restoreState = true
                          launchSingleTop = true
                      }
                  },
  
                  )
          }
  
      }
  }
  </code></pre>
  <p>BottomBar.kt</p>
  <pre><code>const val ROOT_GRAPH_ROUTE = &quot;root&quot;
  const val LOGIN_GRAPH_ROUTE = &quot;login_register&quot;
  const val BOTTOM_BAR_GRAPH_ROUTE = &quot;bottom_bar&quot;
  
  sealed class Screen(val route: String) {
      object LoginScreen : Screen(&quot;login_screen&quot;)
      object RegisterScreen : Screen(&quot;register_screen&quot;)
      object AppScaffold : Screen(&quot;app_scaffold&quot;)
  
  }
  </code></pre>
  <p>Screen.kt</p>
  <pre><code>sealed class NavigationScreen(val route: String, val title: String, @DrawableRes val icon: Int) {
      object EmergencyCallScreen : NavigationScreen(
          route = &quot;emergency_call_screen&quot;,
          title = &quot;Emergency Call&quot;,
          icon = R.drawable.ic_phone
      )
  
      object ChatScreen :
          NavigationScreen(
              route = &quot;chat_screen&quot;,
              title = &quot;Chat&quot;,
              icon = R.drawable.ic_chat)
  
      object SettingsScreen : NavigationScreen(
          route = &quot;settings_screen&quot;,
          title = &quot;Settings&quot;,
          icon = R.drawable.ic_settings
      )
  }
  </code></pre>
  <p>NavigationScreen.kt</p>