title: Jetpack Compose MutableSharedFlow one shot events
body: <p>in my viewmodel I have a function that sends a login request to a server, when successful i want to update a SharedFlow and using this trigger a navigation to another screen</p>
  <pre><code>class loginViewModel: ViewModel() {
  
  private val _authToken = MutableSharedFlow&lt;AuthToken&gt;()
  val authToken: SharedFlow&lt;AuthToken&gt; = _authToken
  
  fun login() {
  ...loginRequest
  
  .onSuccess {
   _authToken.emit(value)}
  }
  </code></pre>
  <p>in my nav graph I set up the viewmodel like so</p>
  <pre><code>private fun NavGraphBuilder.addLogin(navController: NavController) {
  composable(AuthenticationScreens.Login.route) {
  
      val loginViewModel: LoginViewModel = hiltViewModel()
      val authToken by loginViewModel.authToken.collectAsState()
  
          LoginScreen(
          authToken = authToken,
          viewModel = loginViewModel,
          navigateToDashboard= {
              navController.navigate(Dashboard.Dashboard.route)
          }
      )
  
    }
  }
  </code></pre>
  <p>i then do an if check in my loginscreen to navigate to the other screen when the SharedFlow updates</p>
  <pre><code>@Composable
  fun LoginScreen(
  authToken: AuthToken,
  viewModel: LoginViewModel,
  navigateToDashboard: () -&gt; Unit) {
  
  if (authToken.isNotBlank()) {
  navigateToDashboard()}
  }
  </code></pre>
  <p>The code fires but is called constantly even when i've navigated to the next screen, causing lots of flickering and bad UI. Is there a different way I'm supposed to handle navigation events like this or a way to have the composable only read the value once when required?</p>