@devries-cameron20 / t3code Mirror · read-only / commits / 844a9812a0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 01:45 UTC

fix(web): default-branch confirmation keeps its copy while closing (#16907)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Otavio Salvador committed Oct 19, 2026 at 18:10 UTC 844a9812a0015ecc998b6fbb2815847f088215d3
1 file changed +16 -25
apps/web/src/components/GitActionsControl.tsx
+16 -25
@@ -1008,6 +1008,8 @@ export default function GitActionsControl({
1008 const [inlineSuccess, setInlineSuccess] = useState<InlineGitActionSuccess | null>(null);
1009 const [pendingDefaultBranchAction, setPendingDefaultBranchAction] =
1010 useState<PendingDefaultBranchAction | null>(null);
1011 + // Keep the payload until the dialog finishes closing.
1012 + const [isDefaultBranchDialogOpen, setIsDefaultBranchDialogOpen] = useState(false);
1013 const sourceControlScope = { environmentId: activeEnvironmentId, cwd: gitCwd };
1014 const vcsActionState = useAtomValue(vcsActionManager.stateAtom(sourceControlScope));
1015 const visibleInlineSuccess = inlineSuccess?.scopeKey === successScopeKey ? inlineSuccess : null;
@@ -1250,6 +1252,7 @@ export default function GitActionsControl({
1252 ...(onConfirmed ? { onConfirmed } : {}),
1253 ...(filePaths ? { filePaths } : {}),
1254 });
1255 + setIsDefaultBranchDialogOpen(true);
1256 return;
1257 }
1258 onConfirmed?.();
@@ -1359,29 +1362,18 @@ export default function GitActionsControl({
1362 }
1363 }
1364
1362 - const continuePendingDefaultBranchAction = () => {
1363 - if (!pendingDefaultBranchAction) return;
1364 - const { action, commitMessage, onConfirmed, filePaths } = pendingDefaultBranchAction;
1365 - setPendingDefaultBranchAction(null);
1366 - void runGitActionWithToast({
1367 - action,
1368 - ...(commitMessage ? { commitMessage } : {}),
1369 - ...(onConfirmed ? { onConfirmed } : {}),
1370 - ...(filePaths ? { filePaths } : {}),
1371 - skipDefaultBranchPrompt: true,
1372 - });
1373 - };
1374 -
1375 - const checkoutFeatureBranchAndContinuePendingAction = () => {
1376 - if (!pendingDefaultBranchAction) return;
1365 + const continuePendingDefaultBranchAction = (featureBranch: boolean) => {
1366 + if (!isDefaultBranchDialogOpen || !pendingDefaultBranchAction || !canWriteSourceControl) return;
1367 + if (featureBranch && (!canChangeThreadBranch || featureBranchUnavailableReason !== null))
1368 + return;
1369 const { action, commitMessage, onConfirmed, filePaths } = pendingDefaultBranchAction;
1378 - setPendingDefaultBranchAction(null);
1370 + setIsDefaultBranchDialogOpen(false);
1371 void runGitActionWithToast({
1372 action,
1373 ...(commitMessage ? { commitMessage } : {}),
1374 ...(onConfirmed ? { onConfirmed } : {}),
1375 ...(filePaths ? { filePaths } : {}),
1384 - featureBranch: true,
1376 + featureBranch,
1377 skipDefaultBranchPrompt: true,
1378 });
1379 };
@@ -2041,11 +2033,10 @@ export default function GitActionsControl({
2033 />
2034
2035 <Dialog
2044 - open={pendingDefaultBranchAction !== null}
2045 - onOpenChange={(open) => {
2046 - if (!open) {
2047 - setPendingDefaultBranchAction(null);
2048 - }
2036 + open={isDefaultBranchDialogOpen}
2037 + onOpenChange={setIsDefaultBranchDialogOpen}
2038 + onOpenChangeComplete={(open) => {
2039 + if (!open) setPendingDefaultBranchAction(null);
2040 }}
2041 >
2042 <DialogPopup className="max-w-xl">
@@ -2063,7 +2054,7 @@ export default function GitActionsControl({
2054 className="w-full sm:mr-auto sm:w-auto"
2055 variant="outline"
2056 size="sm"
2066 - onClick={() => setPendingDefaultBranchAction(null)}
2057 + onClick={() => setIsDefaultBranchDialogOpen(false)}
2058 >
2059 Abort
2060 </Button>
@@ -2071,7 +2062,7 @@ export default function GitActionsControl({
2062 className="w-full max-w-full sm:w-auto"
2063 variant="outline"
2064 size="sm-multiline"
2074 - onClick={continuePendingDefaultBranchAction}
2065 + onClick={() => continuePendingDefaultBranchAction(false)}
2066 disabled={!canWriteSourceControl}
2067 >
2068 {pendingDefaultBranchActionCopy?.continueLabel ?? "Continue"}
@@ -2079,7 +2070,7 @@ export default function GitActionsControl({
2070 <Button
2071 className="w-full max-w-full sm:w-auto"
2072 size="sm-multiline"
2082 - onClick={checkoutFeatureBranchAndContinuePendingAction}
2073 + onClick={() => continuePendingDefaultBranchAction(true)}
2074 disabled={!canChangeThreadBranch || featureBranchUnavailableReason !== null}
2075 >
2076 Check out feature branch & continue