diff --git a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt index f367e5524b0a..036ee1759a3f 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt +++ b/plugins/git4idea/src/git4idea/ui/branch/dashboard/BranchesTree.kt @@ -243,10 +243,11 @@ internal class FilteringBranchesTree( // need EDT because of RA in TreeUtil.promiseVisit withContext(Dispatchers.EDT) { model.addListener(listener) - if (model.root.children.isNotEmpty() != (searchModel.root.childCount > 0)) { - updateTree() - } try { + val currentlyEmpty = searchModel.root.childCount > 0 + if (!currentlyEmpty || model.root.children.isNotEmpty()) { + updateTree() + } awaitCancellation() } finally {