From 3828ef5e315c527cfffe18bad4e8fb3465b40fbc Mon Sep 17 00:00:00 2001 From: Ivan Semenov Date: Thu, 3 Jul 2025 15:27:03 +0200 Subject: [PATCH] [git] don't rebuild branches dashboard tree when it is empty Otherwise the initial collapse state is not restored GitOrigin-RevId: 3718ce70f3aba5a306956a045c55f95a06a5382c --- .../src/git4idea/ui/branch/dashboard/BranchesTree.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt index a0a414e3c4f9..7335cfc30bef 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt +++ b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt @@ -11,7 +11,6 @@ import com.intellij.openapi.Disposable import com.intellij.openapi.application.EDT import com.intellij.openapi.application.runInEdt import com.intellij.openapi.components.* -import com.intellij.openapi.progress.checkCanceled import com.intellij.openapi.progress.util.BackgroundTaskUtil import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer @@ -243,9 +242,10 @@ internal class FilteringBranchesTree( tree.launchOnShow("Git Dashboard Tree") { // need EDT because of RA in TreeUtil.promiseVisit withContext(Dispatchers.EDT) { - updateTree() - checkCanceled() model.addListener(listener) + if (model.root.children.isNotEmpty() != (searchModel.root.childCount > 0)) { + updateTree() + } try { awaitCancellation() }