diff --git a/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx b/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx index ed692a81370eb0a299bf6847d9c195a4c46563f9..0b168afc98676dd7b7f56892e8726e6eea43166b 100644 --- a/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx +++ b/apps/web/src/components/pullRequest/PullRequestThreadLinks.tsx @@ -50,8 +50,8 @@ function EnabledPullRequestThreadLinks({ onPickerOpenChange, }: PullRequestThreadLinksProps) { const parsed = parseChangeRequestUrl(url); - const currentThreadRef = threadRef?.environmentId === environmentId ? threadRef : null; - const thread = useThreadShell(currentThreadRef); + const thread = useThreadShell(threadRef?.environmentId === environmentId ? threadRef : null); + const currentThreadRef = thread === null ? null : threadRef; const linking = usePullRequestLinking(environmentId); const linkedHere = linking.isLinked(thread, url); const relations = useEnvironmentQuery(