Close git action toast before triggering follow-up action
- Dismiss the success toast before handling Push/Open PR/Create PR CTA clicks - Prevent stale result toasts from lingering while starting the next git action
This commit is contained in:
1 parent
aa6412c3ba
commit
37cd7be09b
1 file changed
+15
-3
@@ -271,6 +271,9 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
|
||||
(action === "commit_push" || action === "commit_push_pr") && !!prUrl;
|
||||
const shouldOfferCreatePrCta =
|
||||
action === "commit_push" && !prUrl && result.push.status === "pushed";
|
||||
const closeResultToast = () => {
|
||||
toastManager.close(progressToastId);
|
||||
};
|
||||
|
||||
toastManager.update(progressToastId, {
|
||||
type: "success",
|
||||
@@ -281,21 +284,30 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
|
||||
? {
|
||||
actionProps: {
|
||||
children: "Push",
|
||||
onClick: () => void runGitActionWithToast({ action: "commit_push" }),
|
||||
onClick: () => {
|
||||
closeResultToast();
|
||||
void runGitActionWithToast({ action: "commit_push" });
|
||||
},
|
||||
},
|
||||
}
|
||||
: shouldOfferOpenPrCta
|
||||
? {
|
||||
actionProps: {
|
||||
children: "Open PR",
|
||||
onClick: () => void api?.shell.openExternal(prUrl),
|
||||
onClick: () => {
|
||||
closeResultToast();
|
||||
void api?.shell.openExternal(prUrl);
|
||||
},
|
||||
},
|
||||
}
|
||||
: shouldOfferCreatePrCta
|
||||
? {
|
||||
actionProps: {
|
||||
children: "Create PR",
|
||||
onClick: () => setActiveDialogAction("create_pr"),
|
||||
onClick: () => {
|
||||
closeResultToast();
|
||||
setActiveDialogAction("create_pr");
|
||||
},
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
|
||||
Reference in new issue
Block a user