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...@@ -215,13 +215,16 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
215 action,215 action,
216 commitMessage,216 commitMessage,
217 forcePushOnlyProgress = false,217 forcePushOnlyProgress = false,
218 onConfirmed,
218 }: {219 }: {
219 action: GitStackedAction;220 action: GitStackedAction;
220 commitMessage?: string;221 commitMessage?: string;
221 forcePushOnlyProgress?: boolean;222 forcePushOnlyProgress?: boolean;
223 onConfirmed?: () => void;
222 }) => {224 }) => {
223 const confirmed = await maybeConfirmPushToDefaultBranch(action);225 const confirmed = await maybeConfirmPushToDefaultBranch(action);
224 if (!confirmed) return;226 if (!confirmed) return;
227 onConfirmed?.();
225228
226 const progressStages = buildGitActionProgressStages({229 const progressStages = buildGitActionProgressStages({
227 action,230 action,
...@@ -274,19 +277,19 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp...@@ -274,19 +277,19 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
274 title: resultToast.title,277 title: resultToast.title,
275 description: resultToast.description,278 description: resultToast.description,
276 timeout: 0,279 timeout: 0,
277 ...(shouldOfferPushCta280 ...(shouldOfferPushCta
278 ? {281 ? {
279 actionProps: {282 actionProps: {
280 children: "Push",283 children: "Push",
281 onClick: () => {284 onClick: () => {
282 closeResultToast();285 void runGitActionWithToast({
283 void runGitActionWithToast({286 action: "commit_push",
284 action: "commit_push",287 forcePushOnlyProgress: true,
285 forcePushOnlyProgress: true,288 onConfirmed: closeResultToast,
286 });289 });
287 },290 },
288 },291 },
289 }292 }
290 : shouldOfferOpenPrCta293 : shouldOfferOpenPrCta
291 ? {294 ? {
292 actionProps: {295 actionProps: {