@@ -112,16 +117,12 @@ export function PullDetailActivitySection({
{!pr.isMerged && pr.state !== "closed" && (
- {status ? (
-
- ) : (
-
- )}
+
)}
@@ -132,6 +133,39 @@ export function PullDetailActivitySection({
);
}
+// ── Merge status section — owns its own polling query ────────────────
+
+function MergeStatusSection({
+ scope,
+ owner,
+ repo,
+ pullNumber,
+}: {
+ scope: GitHubQueryScope;
+ owner: string;
+ repo: string;
+ pullNumber: number;
+}) {
+ const statusQuery = useQuery({
+ ...githubPullStatusQueryOptions(scope, { owner, repo, pullNumber }),
+ refetchOnWindowFocus: "always",
+ refetchInterval: githubCachePolicy.status.staleTimeMs,
+ });
+
+ const status = statusQuery.data ?? null;
+
+ if (!status) return
;
+
+ return (
+
+ );
+}
+
function MergeStatusCard({
status,
owner,
diff --git a/apps/dashboard/src/components/pulls/detail/pull-detail-page.tsx b/apps/dashboard/src/components/pulls/detail/pull-detail-page.tsx
index fb8f15e..d53ec15 100644
--- a/apps/dashboard/src/components/pulls/detail/pull-detail-page.tsx
+++ b/apps/dashboard/src/components/pulls/detail/pull-detail-page.tsx
@@ -7,10 +7,8 @@ import {
} from "#/components/details/detail-page";
import {
githubPullPageQueryOptions,
- githubPullStatusQueryOptions,
githubViewerQueryOptions,
} from "#/lib/github.query";
-import { githubCachePolicy } from "#/lib/github-cache-policy";
import { useHasMounted } from "#/lib/use-has-mounted";
import { useRegisterTab } from "#/lib/use-register-tab";
import { PullBodySection } from "./pull-body-section";
@@ -32,13 +30,6 @@ export function PullDetailPage() {
enabled: hasMounted,
});
- const statusQuery = useQuery({
- ...githubPullStatusQueryOptions(scope, { owner, repo, pullNumber }),
- enabled: hasMounted && pageQuery.data?.detail != null,
- refetchOnWindowFocus: "always",
- refetchInterval: githubCachePolicy.status.staleTimeMs,
- });
-
const viewerQuery = useQuery({
...githubViewerQueryOptions(scope),
enabled: hasMounted,
@@ -47,7 +38,6 @@ export function PullDetailPage() {
const pr = pageQuery.data?.detail;
const comments = pageQuery.data?.comments;
const commits = pageQuery.data?.commits;
- const status = statusQuery.data ?? null;
const viewer = viewerQuery.data ?? null;
useRegisterTab(
@@ -91,11 +81,11 @@ export function PullDetailPage() {
comments={comments}
commits={commits}
isFetching={pageQuery.isFetching}
- status={status}
pr={pr}
owner={owner}
repo={repo}
pullNumber={pullNumber}
+ scope={scope}
/>
>
}
diff --git a/apps/dashboard/src/components/pulls/pull-request-row.tsx b/apps/dashboard/src/components/pulls/pull-request-row.tsx
index 7ade4fe..b6a86c3 100644
--- a/apps/dashboard/src/components/pulls/pull-request-row.tsx
+++ b/apps/dashboard/src/components/pulls/pull-request-row.tsx
@@ -6,12 +6,11 @@ import {
GitPullRequestIcon,
ViewIcon,
} from "@diffkit/icons";
-import { Markdown } from "@diffkit/ui/components/markdown";
import { Spinner } from "@diffkit/ui/components/spinner";
import { cn } from "@diffkit/ui/lib/utils";
import { useQuery } from "@tanstack/react-query";
import { Link, useRouter } from "@tanstack/react-router";
-import { useState } from "react";
+import { lazy, memo, Suspense, useState } from "react";
import { formatRelativeTime } from "#/lib/format-relative-time";
import {
type GitHubQueryScope,
@@ -20,6 +19,12 @@ import {
import type { PullSummary } from "#/lib/github.types";
import { preloadRouteOnce } from "#/lib/route-preload";
+const Markdown = lazy(() =>
+ import("@diffkit/ui/components/markdown").then((mod) => ({
+ default: mod.Markdown,
+ })),
+);
+
function getPrStateProps(pr: PullSummary) {
if (pr.isDraft) {
return { icon: GitPullRequestDraftIcon, color: "text-muted-foreground" };
@@ -33,7 +38,7 @@ function getPrStateProps(pr: PullSummary) {
return { icon: GitPullRequestIcon, color: "text-green-500" };
}
-export function PullRequestRow({
+export const PullRequestRow = memo(function PullRequestRow({
pr,
scope,
}: {
@@ -149,9 +154,17 @@ export function PullRequestRow({