Close result toast only after push confirmation

- Add optional `onConfirmed` callback to `runGitActionWithToast`
- Use it from the Push CTA so the existing toast is closed only after user confirms push
This commit is contained in:
Julius Marminge committed 2026-02-14 23:57:11 -08:00
1 parent 170c3a7162
commit cce74f913c
1 file changed
+16 -13
+16 -13
View File
@@ -215,13 +215,16 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
action,
commitMessage,
forcePushOnlyProgress = false,
onConfirmed,
}: {
action: GitStackedAction;
commitMessage?: string;
forcePushOnlyProgress?: boolean;
onConfirmed?: () => void;
}) => {
const confirmed = await maybeConfirmPushToDefaultBranch(action);
if (!confirmed) return;
onConfirmed?.();
const progressStages = buildGitActionProgressStages({
action,
@@ -274,19 +277,19 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
title: resultToast.title,
description: resultToast.description,
timeout: 0,
...(shouldOfferPushCta
? {
actionProps: {
children: "Push",
onClick: () => {
closeResultToast();
void runGitActionWithToast({
action: "commit_push",
forcePushOnlyProgress: true,
});
},
},
}
...(shouldOfferPushCta
? {
actionProps: {
children: "Push",
onClick: () => {
void runGitActionWithToast({
action: "commit_push",
forcePushOnlyProgress: true,
onConfirmed: closeResultToast,
});
},
},
}
: shouldOfferOpenPrCta
? {
actionProps: {