Skip to content

Commit 1f099d9

Browse files
authored
Git branch picker not load branch list and switch branch issue (#1637)
* fix: branch picker refresh issue and switch branch issue * fix: source control history view not refresh after switch branch
1 parent c395991 commit 1f099d9

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

CodeEdit/Features/CodeEditUI/Views/ToolbarBranchPicker.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct ToolbarBranchPicker: View {
8383
}
8484
.task {
8585
await self.sourceControlManager?.refreshCurrentBranch()
86+
await self.sourceControlManager?.refreshBranches()
8687
}
8788
}
8889

@@ -160,9 +161,6 @@ struct ToolbarBranchPicker: View {
160161
.padding(.top, 10)
161162
.padding(5)
162163
.frame(width: 340)
163-
.task {
164-
await sourceControlManager.refreshBranches()
165-
}
166164
}
167165

168166
func headerLabel(_ title: String) -> some View {
@@ -194,9 +192,6 @@ struct ToolbarBranchPicker: View {
194192
self.title = title
195193
}
196194

197-
@Environment(\.dismiss)
198-
private var dismiss
199-
200195
var body: some View {
201196
Button {
202197
switchBranch()
@@ -216,9 +211,6 @@ struct ToolbarBranchPicker: View {
216211
Task {
217212
do {
218213
try await sourceControlManager.checkoutBranch(branch: branch)
219-
await MainActor.run {
220-
dismiss()
221-
}
222214
} catch {
223215
await sourceControlManager.showAlertForError(title: "Failed to checkout", error: error)
224216
}

CodeEdit/Features/NavigatorArea/SourceControlNavigator/History/Views/SourceControlNavigatorHistoryView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ struct SourceControlNavigatorHistoryView: View {
8989
}
9090
}
9191
}
92+
.onReceive(sourceControlManager.$currentBranch) { _ in
93+
Task {
94+
await updateCommitHistory()
95+
}
96+
}
9297
.task {
9398
await updateCommitHistory()
9499
}

0 commit comments

Comments
 (0)