authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-14 23:57:11-08:00
committergravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-14 23:57:11-08:00
logcce74f913c03665bda4fe1bf4448fea42e250946
tree0727a3caa706e5071eaea3dc8894f167c80d2c8b
parent170c3a7162525df90164e118023e3bc8bb97dda0

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

1 files changed, 16 insertions(+), 13 deletions(-)

apps/web/src/components/GitActionsControl.tsx+16-13
......@@ -215,13 +215,16 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
215215 action,
216216 commitMessage,
217217 forcePushOnlyProgress = false,
218 onConfirmed,
218219 }: {
219220 action: GitStackedAction;
220221 commitMessage?: string;
221222 forcePushOnlyProgress?: boolean;
223 onConfirmed?: () => void;
222224 }) => {
223225 const confirmed = await maybeConfirmPushToDefaultBranch(action);
224226 if (!confirmed) return;
227 onConfirmed?.();
225228
226229 const progressStages = buildGitActionProgressStages({
227230 action,
......@@ -274,19 +277,19 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
274277 title: resultToast.title,
275278 description: resultToast.description,
276279 timeout: 0,
277 ...(shouldOfferPushCta
278 ? {
279 actionProps: {
280 children: "Push",
281 onClick: () => {
282 closeResultToast();
283 void runGitActionWithToast({
284 action: "commit_push",
285 forcePushOnlyProgress: true,
286 });
287 },
288 },
289 }
280 ...(shouldOfferPushCta
281 ? {
282 actionProps: {
283 children: "Push",
284 onClick: () => {
285 void runGitActionWithToast({
286 action: "commit_push",
287 forcePushOnlyProgress: true,
288 onConfirmed: closeResultToast,
289 });
290 },
291 },
292 }
290293 : shouldOfferOpenPrCta
291294 ? {
292295 actionProps: {