Skip to content
TypeScript

fix(web): a refused review shows GitHub's reason (#22382)

tiliakoos45d29b45fe9e
diff --git a/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx b/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx
index 1b69ef76acf..57c933256ff 100644
--- a/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx
@@ -5,11 +5,13 @@ import { CheckIcon, MessageSquareIcon, XCircleIcon } from "lucide-react";
import { useState, type ReactNode, type RefObject } from "react";
import { pullRequestEnvironment } from "~/state/pullRequests";
+import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import { Button } from "../ui/button";
import { Select, SelectItem, SelectPopup, SelectTrigger } from "../ui/select";
import { Textarea } from "../ui/textarea";
import { toastManager } from "../ui/toast";
+import { readableFailure } from "./pullRequestDetail.logic";
import {
pullRequestReviewKey,
usePendingReviewComments,
@@ -95,7 +97,14 @@ export function PullRequestReviewForm({
});
onPendingChange(false);
if (result._tag === "Failure") {
- toastManager.add({ type: "error", title: "The review could not be submitted" });
+ toastManager.add({
+ type: "error",
+ title: "The review could not be submitted",
+ description: readableFailure(
+ squashAtomCommandFailure(result),
+ "The host refused the review. Your draft is still here to try again.",
+ ),
+ });
return;
}
// Preserve comments and summary edits made during submission.