Restore branch selector state after checkout failures
- Revert optimistic branch selection when checkout fails - Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
acb9bf1054
commit
5efdbb0d4c
1 file changed
+2
@@ -224,6 +224,7 @@ export function BranchToolbarBranchSelector({
|
||||
onComposerFocusRequest?.();
|
||||
|
||||
runBranchAction(async () => {
|
||||
const previousBranch = resolvedActiveBranch;
|
||||
setOptimisticBranch(selectedBranchName);
|
||||
try {
|
||||
const checkoutResult = await api.git.checkout({
|
||||
@@ -236,6 +237,7 @@ export function BranchToolbarBranchSelector({
|
||||
setOptimisticBranch(nextBranchName);
|
||||
onSetThreadBranch(nextBranchName, selectionTarget.nextWorktreePath);
|
||||
} catch (error) {
|
||||
setOptimisticBranch(previousBranch);
|
||||
toastManager.add({
|
||||
type: "error",
|
||||
title: "Failed to checkout branch.",
|
||||
|
||||
Reference in new issue
Block a user