TypeScript
perf(web): the pull request guide tab compiles without manual memoization (#20716)
Julius Marminged2213c8be56a
diff --git a/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx b/apps/web/src/components/pullRequest/PullRequestGuideTab.tsxindex 0dcc03494da..c9a3e89c7ad 100644--- a/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx+++ b/apps/web/src/components/pullRequest/PullRequestGuideTab.tsx@@ -1,6 +1,6 @@import type { EnvironmentId, PullRequestRef, PullRequestReviewGuideStop } from "@t3tools/contracts";import { SparklesIcon, TriangleAlertIcon } from "lucide-react";-import { useEffect, useEffectEvent, useMemo } from "react";+import { useEffect, useEffectEvent } from "react";import type { ReviewCommentContext } from "~/reviewCommentContext";@@ -56,26 +56,23 @@ export function PullRequestGuideTab({const pending = usePendingReviewComments(reference);const addComment = usePullRequestReviewStore((store) => store.addComment);const removeComment = usePullRequestReviewStore((store) => store.removeComment);- const commenting = useMemo<ExcerptCommenting | null>(- () =>- !canComment && onAskAboutLines === null- ? null- : {- canComment,- pending,- onComment: ({ path, oldPath, position, body }) =>- addComment(reviewKey, {- id: nextPendingReviewCommentId(),- path,- ...(oldPath === null ? {} : { oldPath }),- position,- body,- }),- onRemove: (commentId) => removeComment(reviewKey, commentId),- onAskAgent: onAskAboutLines,- },- [addComment, canComment, onAskAboutLines, pending, removeComment, reviewKey],- );+ const commenting: ExcerptCommenting | null =+ !canComment && onAskAboutLines === null+ ? null+ : {+ canComment,+ pending,+ onComment: ({ path, oldPath, position, body }) =>+ addComment(reviewKey, {+ id: nextPendingReviewCommentId(),+ path,+ ...(oldPath === null ? {} : { oldPath }),+ position,+ body,+ }),+ onRemove: (commentId) => removeComment(reviewKey, commentId),+ onAskAgent: onAskAboutLines,+ };useEffect(() => {if (!active) return;useGuideRunStore.getState().setShown(runKey);