Skip to content

Commit cc1afce

Browse files
perf(web): pull request thread links compile with the React Compiler
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a7402ad commit cc1afce

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ export const REACT_COMPILED_FILES = [
6969
"apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx",
7070
"apps/web/src/components/pullRequest/usePullRequestActions.ts",
7171
"apps/web/src/components/pullRequest/PullRequestReviewAnnotation.tsx",
72+
"apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx",
7273
] as const;

‎apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";
22
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
3+
import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
34
import type { EnvironmentId, PullRequestRef, ScopedThreadRef, ThreadId } from "@t3tools/contracts";
45
import { CheckIcon, MessageSquareIcon } from "lucide-react";
56
import { useState } from "react";
@@ -75,17 +76,18 @@ function EnabledPullRequestThreadLinks({
7576
const changeLink = async (threadId: ThreadId, remove: boolean) => {
7677
if (parsed === null || pending) return;
7778
setPending(true);
78-
try {
79-
await linking.changeLink(scopeThreadRef(environmentId, threadId), url, !remove);
80-
} catch (error) {
79+
const result = await settlePromise(() =>
80+
linking.changeLink(scopeThreadRef(environmentId, threadId), url, !remove),
81+
);
82+
setPending(false);
83+
if (result._tag === "Failure") {
84+
const error = squashAtomCommandFailure(result);
8185
toastManager.add({
8286
type: "error",
8387
title: remove ? "Could not unlink the pull request" : "Could not link the pull request",
8488
description: error instanceof Error ? error.message : String(error),
8589
});
8690
return;
87-
} finally {
88-
setPending(false);
8991
}
9092
if (linking.mode === "multiple") {
9193
appAtomRegistry.refresh(

0 commit comments

Comments
 (0)