[git] don't rebuild branches dashboard tree when it is empty

Otherwise the initial collapse state is not restored

GitOrigin-RevId: 3718ce70f3aba5a306956a045c55f95a06a5382c
This commit is contained in:
Ivan Semenov
2025-07-03 20:08:09 +00:00
committed by intellij-monorepo-bot
parent e0624e9192
commit 3828ef5e31
@@ -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()
}