Skip to content
TypeScript

perf(web): pull request thread links compile with the React Compiler (#20494)

Julius Marmingeba3e228d9638
diff --git a/apps/web/reactCompiledFiles.ts b/apps/web/reactCompiledFiles.ts
index 52008a159bd..a25ffe3dacf 100644
--- a/apps/web/reactCompiledFiles.ts
+++ b/apps/web/reactCompiledFiles.ts
@@ -69,4 +69,5 @@ export const REACT_COMPILED_FILES = [
"apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx",
"apps/web/src/components/pullRequest/usePullRequestActions.ts",
"apps/web/src/components/pullRequest/PullRequestReviewAnnotation.tsx",
+ "apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx",
] as const;
diff --git a/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx b/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx
index eab395db451..f9dff552a95 100644
--- a/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx
@@ -1,5 +1,6 @@
import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
+import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import type { EnvironmentId, PullRequestRef, ScopedThreadRef, ThreadId } from "@t3tools/contracts";
import { CheckIcon, MessageSquareIcon } from "lucide-react";
import { useState } from "react";
@@ -75,17 +76,18 @@ function EnabledPullRequestThreadLinks({
const changeLink = async (threadId: ThreadId, remove: boolean) => {
if (parsed === null || pending) return;
setPending(true);
- try {
- await linking.changeLink(scopeThreadRef(environmentId, threadId), url, !remove);
- } catch (error) {
+ const result = await settlePromise(() =>
+ linking.changeLink(scopeThreadRef(environmentId, threadId), url, !remove),
+ );
+ setPending(false);
+ if (result._tag === "Failure") {
+ const error = squashAtomCommandFailure(result);
toastManager.add({
type: "error",
title: remove ? "Could not unlink the pull request" : "Could not link the pull request",
description: error instanceof Error ? error.message : String(error),
});
return;
- } finally {
- setPending(false);
}
if (linking.mode === "multiple") {
appAtomRegistry.refresh(