|
1 | 1 | import type { EnvironmentId, PullRequestRef, PullRequestReviewGuideStop } from "@t3tools/contracts"; |
2 | 2 | import { SparklesIcon, TriangleAlertIcon } from "lucide-react"; |
3 | | -import { useEffect, useEffectEvent, useMemo } from "react"; |
| 3 | +import { useEffect, useEffectEvent } from "react"; |
4 | 4 |
|
5 | 5 | import type { ReviewCommentContext } from "~/reviewCommentContext"; |
6 | 6 |
|
@@ -56,26 +56,23 @@ export function PullRequestGuideTab({ |
56 | 56 | const pending = usePendingReviewComments(reference); |
57 | 57 | const addComment = usePullRequestReviewStore((store) => store.addComment); |
58 | 58 | const removeComment = usePullRequestReviewStore((store) => store.removeComment); |
59 | | - const commenting = useMemo<ExcerptCommenting | null>( |
60 | | - () => |
61 | | - !canComment && onAskAboutLines === null |
62 | | - ? null |
63 | | - : { |
64 | | - canComment, |
65 | | - pending, |
66 | | - onComment: ({ path, oldPath, position, body }) => |
67 | | - addComment(reviewKey, { |
68 | | - id: nextPendingReviewCommentId(), |
69 | | - path, |
70 | | - ...(oldPath === null ? {} : { oldPath }), |
71 | | - position, |
72 | | - body, |
73 | | - }), |
74 | | - onRemove: (commentId) => removeComment(reviewKey, commentId), |
75 | | - onAskAgent: onAskAboutLines, |
76 | | - }, |
77 | | - [addComment, canComment, onAskAboutLines, pending, removeComment, reviewKey], |
78 | | - ); |
| 59 | + const commenting: ExcerptCommenting | null = |
| 60 | + !canComment && onAskAboutLines === null |
| 61 | + ? null |
| 62 | + : { |
| 63 | + canComment, |
| 64 | + pending, |
| 65 | + onComment: ({ path, oldPath, position, body }) => |
| 66 | + addComment(reviewKey, { |
| 67 | + id: nextPendingReviewCommentId(), |
| 68 | + path, |
| 69 | + ...(oldPath === null ? {} : { oldPath }), |
| 70 | + position, |
| 71 | + body, |
| 72 | + }), |
| 73 | + onRemove: (commentId) => removeComment(reviewKey, commentId), |
| 74 | + onAskAgent: onAskAboutLines, |
| 75 | + }; |
79 | 76 | useEffect(() => { |
80 | 77 | if (!active) return; |
81 | 78 | useGuideRunStore.getState().setShown(runKey); |
|
0 commit comments