title: Permission called twice when we have mutableStateOf in Jetpack compose
body: <p>I have following permission check in Jetpack Compose :</p>
  <pre><code>val launcher = rememberLauncherForActivityResult(
      ActivityResultContracts.RequestMultiplePermissions()
  ) { permissions -&gt;
      if (permissions.values.first { true }) {
          log.info(&quot;Permission is granted&quot;)
          shouldDisplayQuestionDialog.value = true
      } else {
          log.info(&quot;Permission is not granted&quot;)
      }
  }
  </code></pre>
  <p>When I deny permission, <strong>Permission is not granted</strong> log called once.</p>
  <p>Now I change the code to this :</p>
  <pre><code>val displayEmptyScreen = remember { mutableStateOf(false) }
  val launcher = rememberLauncherForActivityResult(
      ActivityResultContracts.RequestMultiplePermissions()
  ) { permissions -&gt;
      if (permissions.values.first { true }) {
          log.info(&quot;Permission is granted&quot;)
          shouldDisplayQuestionDialog.value = true
      } else {
          log.info(&quot;Permission is not granted&quot;)
          displayEmptyScreen.value = true
      }
  }
  </code></pre>
  <p>Now <strong>Permission is not granted</strong> log called twice after adding the <code>mutableStateOf</code>. Why is that? How to make it call once?</p>
  <p><strong>ADDENDA</strong></p>
  <pre><code>@Composable
      private fun DisplayPermissionDialog(shouldDisplayQuestionDialog: MutableState&lt;Boolean&gt;) {
          val displayEmptyScreen = remember { mutableStateOf(false) }
          val launcher = rememberLauncherForActivityResult(
              ActivityResultContracts.RequestMultiplePermissions()
          ) { permissions -&gt;
              if (permissions.values.first { true }) {
                  log.info(&quot;Permission is granted&quot;)
                  shouldDisplayQuestionDialog.value = true
              } else {
                  log.info(&quot;Permission is not granted&quot;)
                  displayEmptyScreen.value = true
              }
          }
          DisplayQuestionAlertDialog(shouldDisplayQuestionDialog)
          if (displayEmptyScreen.value) {
              Box {
                  // This box works as background
                  Box(
                      modifier = Modifier
                          .matchParentSize()
                          .background(Color.White)
                  )
              }
          }
          val context = LocalContext.current
          when (PackageManager.PERMISSION_GRANTED) {
              ContextCompat.checkSelfPermission(
                  context,
                  Manifest.permission.READ_EXTERNAL_STORAGE
              ) -&gt; {
                  LaunchedEffect(Unit) {
                      log.info(&quot;Set State for mutableStateFlow&quot;)
                      viewModel.setState()
                  }
                  DisplayQuestionAlertDialog(shouldDisplayQuestionDialog)
              }
              else -&gt; {
                  Handler(Looper.getMainLooper()).post {
                      // Asking for permission
                      launcher.launch(
                          arrayOf(
                              Manifest.permission.READ_EXTERNAL_STORAGE,
                              Manifest.permission.WRITE_EXTERNAL_STORAGE
                          )
                      )
                  }
              }
          }
      }
  </code></pre>