Skip to content

Commit 004247f

Browse files
Inline feature-branch git action handling
- Remove the extra checkout helper in GitActionsControl - Keep feature-branch flags with the action calls
1 parent a77c4ca commit 004247f

1 file changed

Lines changed: 11 additions & 31 deletions

File tree

apps/web/src/components/GitActionsControl.tsx

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -593,38 +593,23 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
593593
...(filePaths ? { filePaths } : {}),
594594
skipDefaultBranchPrompt: true,
595595
});
596-
}, [pendingDefaultBranchAction, runGitActionWithToast]);
597-
598-
const checkoutNewBranchAndRunAction = useCallback(
599-
(actionParams: {
600-
action: GitStackedAction;
601-
commitMessage?: string;
602-
forcePushOnlyProgress?: boolean;
603-
onConfirmed?: () => void;
604-
filePaths?: string[];
605-
}) => {
606-
void runGitActionWithToast({
607-
...actionParams,
608-
featureBranch: true,
609-
skipDefaultBranchPrompt: true,
610-
});
611-
},
612-
[runGitActionWithToast],
613-
);
596+
}, [pendingDefaultBranchAction]);
614597

615598
const checkoutFeatureBranchAndContinuePendingAction = useCallback(() => {
616599
if (!pendingDefaultBranchAction) return;
617600
const { action, commitMessage, forcePushOnlyProgress, onConfirmed, filePaths } =
618601
pendingDefaultBranchAction;
619602
setPendingDefaultBranchAction(null);
620-
checkoutNewBranchAndRunAction({
603+
void runGitActionWithToast({
621604
action,
622605
...(commitMessage ? { commitMessage } : {}),
623606
forcePushOnlyProgress,
624607
...(onConfirmed ? { onConfirmed } : {}),
625608
...(filePaths ? { filePaths } : {}),
609+
featureBranch: true,
610+
skipDefaultBranchPrompt: true,
626611
});
627-
}, [pendingDefaultBranchAction, checkoutNewBranchAndRunAction]);
612+
}, [pendingDefaultBranchAction]);
628613

629614
const runDialogActionOnNewBranch = useCallback(() => {
630615
if (!isCommitDialogOpen) return;
@@ -635,18 +620,14 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
635620
setExcludedFiles(new Set());
636621
setIsEditingFiles(false);
637622

638-
checkoutNewBranchAndRunAction({
623+
void runGitActionWithToast({
639624
action: "commit",
640625
...(commitMessage ? { commitMessage } : {}),
641626
...(!allSelected ? { filePaths: selectedFiles.map((f) => f.path) } : {}),
627+
featureBranch: true,
628+
skipDefaultBranchPrompt: true,
642629
});
643-
}, [
644-
allSelected,
645-
isCommitDialogOpen,
646-
dialogCommitMessage,
647-
checkoutNewBranchAndRunAction,
648-
selectedFiles,
649-
]);
630+
}, [allSelected, isCommitDialogOpen, dialogCommitMessage, selectedFiles]);
650631

651632
const runQuickAction = useCallback(() => {
652633
if (quickAction.kind === "open_pr") {
@@ -686,7 +667,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
686667
if (quickAction.action) {
687668
void runGitActionWithToast({ action: quickAction.action });
688669
}
689-
}, [openExistingPr, pullMutation, quickAction, runGitActionWithToast, threadToastData]);
670+
}, [openExistingPr, pullMutation, quickAction, threadToastData]);
690671

691672
const openDialogForMenuItem = useCallback(
692673
(item: GitActionMenuItem) => {
@@ -707,7 +688,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
707688
setIsEditingFiles(false);
708689
setIsCommitDialogOpen(true);
709690
},
710-
[openExistingPr, runGitActionWithToast, setIsCommitDialogOpen],
691+
[openExistingPr, setIsCommitDialogOpen],
711692
);
712693

713694
const runDialogAction = useCallback(() => {
@@ -726,7 +707,6 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
726707
allSelected,
727708
dialogCommitMessage,
728709
isCommitDialogOpen,
729-
runGitActionWithToast,
730710
selectedFiles,
731711
setDialogCommitMessage,
732712
setIsCommitDialogOpen,

0 commit comments

Comments
 (0)