From a28c8ee5867eb877403f11f070a82a3714e636ac Mon Sep 17 00:00:00 2001 From: Chris Lemaire Date: Mon, 30 Sep 2024 18:38:47 +0200 Subject: [PATCH] [gitlab/github] Resolve warnings about early updating toolbar Toolbar was deterministically updated before adding it to the component tree. `launch` is more likely to delay that update, though I guess it may not be 100%. GitOrigin-RevId: 912684ffff5ade602b3b0448bdbd25a304426b23 --- .../ui/toolwindow/create/GHPRCreateComponentFactory.kt | 2 +- .../ui/create/GitLabMergeRequestCreateComponentFactory.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/toolwindow/create/GHPRCreateComponentFactory.kt b/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/toolwindow/create/GHPRCreateComponentFactory.kt index e24ed33b85ef..580603da7d16 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/toolwindow/create/GHPRCreateComponentFactory.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/pullrequest/ui/toolwindow/create/GHPRCreateComponentFactory.kt @@ -235,7 +235,7 @@ internal object GHPRCreateComponentFactory { } // Force an action's update with every new value for commits and template - cs.launchNow { + cs.launch { vm.titleAndDescriptionGenerationVm.collect { if (it == null) { toolbar.updateActionsAsync() diff --git a/plugins/gitlab/src/org/jetbrains/plugins/gitlab/mergerequest/ui/create/GitLabMergeRequestCreateComponentFactory.kt b/plugins/gitlab/src/org/jetbrains/plugins/gitlab/mergerequest/ui/create/GitLabMergeRequestCreateComponentFactory.kt index a2bc36950b86..61d5701fd153 100644 --- a/plugins/gitlab/src/org/jetbrains/plugins/gitlab/mergerequest/ui/create/GitLabMergeRequestCreateComponentFactory.kt +++ b/plugins/gitlab/src/org/jetbrains/plugins/gitlab/mergerequest/ui/create/GitLabMergeRequestCreateComponentFactory.kt @@ -22,6 +22,7 @@ import git4idea.ui.branch.MergeDirectionModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch import org.jetbrains.plugins.gitlab.mergerequest.ui.create.model.* import org.jetbrains.plugins.gitlab.util.GitLabBundle import org.jetbrains.plugins.gitlab.util.GitLabProjectMapping @@ -107,7 +108,7 @@ internal object GitLabMergeRequestCreateComponentFactory { } // Force an action's update with new values for commits and generating state - launchNow { + launch { createVm.titleGenerationVm.collect { if (it == null) { toolbar.updateActionsAsync()