Hello, I have a composable like this ```@Composabl...
# compose
a
Hello, I have a composable like this
Copy code
@Composable
private fun DisplayUserProfile() {
    val userViewModel: UserProfileViewModel = rememberViewModel()
    
    if (userViewModel.userProfileStatus.isSuccess()) {
        ShowUserProfile { userProfileState ->
            when (userProfileState) {
                is UserProfileState.Loading -> userViewModel.onProfileLoading()
                is UserProfileState.Loaded -> userViewModel.onProfileLoaded(userProfileState.data)
               
            }
        }
    }
}



@Composable
private fun SomeScreenImpl(
    modifier: Modifier
) {
  HandleProfileUpdate(
      onUpdate = {
          userViewModel.reset()
          userViewModel.fetchUserProfile()
      }, 
      onCancel = {
         userViewModel.reset()
     }
  )
}
and VM has this
Copy code
var userProfileStatus: ViewResult<UserProfile> by mutableStateOf(ViewResult.Uninitialized)

fun fetchUserProfile() {
    viewModelScope.launch {
        userProfileStatus = ViewResult.Loaded(UserProfile("John Doe", "john.doe@example.com"))
    }
}
I am seeing
ShowUserProfile
composable being recomposed twice, even though
fetchUserProfile
is called only once. Not sure from where and how the second recomposition is happening. Any help would be really appreciated?
z
1. Why does it matter? One extra recomposition should be inconsequential to performance. It’s a fools errand to try to get a specific number of recompositions - the runtime doesn’t actually make any guarantees you can rely on for this. 2. What does the VM’s
reset
method do? 3. Is
ShowUserProfile
being recomposed or is
DisplayUserProfile
being recomposed and calling ShowUserProfile again? If the former, what’s that composable look like?