diff --git a/apps/web/src/components/pullRequest/PullRequestStackMenu.tsx b/apps/web/src/components/pullRequest/PullRequestStackMenu.tsx index 61eeed0f0f32..ff8e886d14af 100644 --- a/apps/web/src/components/pullRequest/PullRequestStackMenu.tsx +++ b/apps/web/src/components/pullRequest/PullRequestStackMenu.tsx @@ -87,6 +87,11 @@ export function PullRequestStackMenu({ layer.headSha ? [{ number: layer.number, headSha: layer.headSha }] : [], ); setPending(true); + setConfirmation(null); + const toastId = toastManager.add({ + type: "loading", + title: action === "merge" ? "Merging stack..." : "Rebasing stack...", + }); const result = await runAction({ environmentId, input: { @@ -99,16 +104,15 @@ export function PullRequestStackMenu({ }, }); setPending(false); - setConfirmation(null); onActed(); if (result._tag === "Failure") { - toastManager.add({ + toastManager.update(toastId, { type: "error", - title: "Stack operation did not complete", + title: action === "merge" ? "Could not merge the stack" : "Could not rebase the stack", description: String(squashAtomCommandFailure(result)), }); } else { - toastManager.add({ + toastManager.update(toastId, { type: "success", title: action === "merge" ? "Stack merge request completed" : "Stack rebased", description: @@ -216,10 +220,10 @@ export function PullRequestStackMenu({ { - if (!value && !pending) setConfirmation(null); + if (!value) setConfirmation(null); }} > - + {confirmation === "merge" @@ -245,11 +249,11 @@ export function PullRequestStackMenu({ - -