From f0d0b80642cd8eaa0ea951d9481c1615886e6506 Mon Sep 17 00:00:00 2001
From: "t3-code[bot]" <208119805+t3-code[bot]@users.noreply.github.com>
Date: Wed, 12 Aug 2026 21:43:20 +0000
Subject: [PATCH] fix(web): show pull request refresh feedback
Co-authored-by: Bilal Bakr <62337003+Bil0000@users.noreply.github.com>
---
.../pullRequest/PullRequestDetailPanel.tsx | 42 ++++++++++++++++---
1 file changed, 36 insertions(+), 6 deletions(-)
diff --git a/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx b/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
index 7237b435748..081ca93b242 100644
--- a/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
@@ -531,11 +531,38 @@ export function PullRequestDetailPanel({
// and at worst answer from it.
const invalidate = useAtomCommand(pullRequestEnvironment.invalidate, { reportFailure: false });
const [refreshToken, setRefreshToken] = useState(0);
- const refreshFromHost = useCallback(async () => {
- await invalidate({ environmentId, input: { reference } });
- refreshDetail();
- setRefreshToken((token) => token + 1);
- }, [environmentId, invalidate, reference, refreshDetail]);
+ const refreshFromHost = useCallback(
+ async (showFeedback = false) => {
+ const toastId = showFeedback
+ ? toastManager.add({
+ type: "loading",
+ title: "Refreshing pull request...",
+ })
+ : null;
+ const result = await invalidate({ environmentId, input: { reference } });
+ refreshDetail();
+ setRefreshToken((token) => token + 1);
+ if (toastId !== null) {
+ toastManager.update(
+ toastId,
+ result._tag === "Failure"
+ ? {
+ type: "error",
+ title: "Could not refresh pull request",
+ description: readableFailure(
+ squashAtomCommandFailure(result),
+ "Try again in a moment.",
+ ),
+ }
+ : {
+ type: "success",
+ title: "Pull request refreshed",
+ },
+ );
+ }
+ },
+ [environmentId, invalidate, reference, refreshDetail],
+ );
// A refresh asked for by the page: the detail, and through the token below, the diff with it.
const appliedForcedToken = useRef(forcedRefreshToken);
useEffect(() => {
@@ -1143,7 +1170,10 @@ export function PullRequestDetailPanel({
-