fix(web): stack merge dialog closes as soon as you confirm (#17116)

This commit is contained in:
oliver authored and GitHub committed 2026-10-08 11:39:47 -07:00
1 parent de72286ee5
commit eb1cf7bd0e
1 file changed
+13 -9
@@ -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({
<Dialog
open={confirmation !== null}
onOpenChange={(value) => {
if (!value && !pending) setConfirmation(null);
if (!value) setConfirmation(null);
}}
>
<DialogPopup className="max-w-md" showCloseButton={!pending}>
<DialogPopup className="max-w-md">
<DialogHeader>
<DialogTitle>
{confirmation === "merge"
@@ -245,11 +249,11 @@ export function PullRequestStackMenu({
</ul>
</DialogPanel>
<DialogFooter>
<Button variant="outline" disabled={pending} onClick={() => setConfirmation(null)}>
<Button variant="outline" onClick={() => setConfirmation(null)}>
Cancel
</Button>
<Button disabled={pending} onClick={() => void run()}>
{pending ? "Working…" : confirmation === "merge" ? "Merge stack" : "Rebase stack"}
<Button onClick={() => void run()}>
{confirmation === "merge" ? "Merge stack" : "Rebase stack"}
</Button>
</DialogFooter>
</DialogPopup>