From 17642b2d81f3e4373aba1157ccc11f89db06deb2 Mon Sep 17 00:00:00 2001 From: BlitzOS Upstream Prep Date: Wed, 2 Sep 2026 00:26:21 +0000 Subject: [PATCH] fix(components): gate the archived row's PR badge on the githubIntegration capability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An archived session carries `pullRequests` whatever platform is reading it, so the archive row draws a PR status glyph linking to github.com on a composition that declares no `githubIntegration` and has no GitHub App behind the link. `useAppCapability('githubIntegration')` is the check the Session surfaces make; the archive row simply never asked. `getArchivedSessionItemViewModel` gains a third parameter defaulting to true, and drops the pull-request list with the capability off — which zeroes `prUrl`, `prStatusMeta`, `PrIcon` and `prTooltipLabel` together, the same shape `getSessionGitHubState` uses. Both item components read the capability and pass it. No new prop and no new capability. Model: claude-opus-5[1m] --- .../src/components/archive/archive-view.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/components/src/components/archive/archive-view.tsx b/packages/components/src/components/archive/archive-view.tsx index 71d5c0c68..c778f8950 100644 --- a/packages/components/src/components/archive/archive-view.tsx +++ b/packages/components/src/components/archive/archive-view.tsx @@ -25,6 +25,7 @@ import { } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import { cn } from '@/lib/utils'; +import { useAppCapability } from '@/lib/app-platform'; import { Button } from '@/ui/button'; import { Checkbox } from '@/ui/checkbox'; import { @@ -314,9 +315,16 @@ type ArchivedSessionItemViewModel = { prTooltipLabel: string; }; +/** + * @param gitHubIntegrationAvailable - The `githubIntegration` platform + * capability. With it off there is no GitHub App behind the row's PR badge, so + * the pull request is dropped here rather than at each of the four values it + * feeds — the same shape `getSessionGitHubState` uses. + */ function getArchivedSessionItemViewModel( session: SessionMeta, - now: Date + now: Date, + gitHubIntegrationAvailable = true ): ArchivedSessionItemViewModel { const title = session.title?.trim() || 'Untitled session'; const relativeTime = formatRelativeTime(session.lastMessageAt, now); @@ -324,7 +332,7 @@ function getArchivedSessionItemViewModel( const diffStats = session.diffStats ?? { allChange: { add: 0, del: 0 } }; const hasChanges = diffStats.allChange.add !== 0 || diffStats.allChange.del !== 0; - const pullRequests = session.pullRequests ?? []; + const pullRequests = gitHubIntegrationAvailable ? session.pullRequests ?? [] : []; const latestPr = pullRequests.length > 0 ? pullRequests.some((pr) => getSessionPullRequestLegacyFields(pr).reportedAt) @@ -401,6 +409,7 @@ function DesktopArchivedSessionItem({ onEnterMultiSelect, owner, }: ArchivedSessionItemBaseProps) { + const gitHubIntegrationAvailable = useAppCapability('githubIntegration'); const { title, relativeTime, @@ -411,7 +420,7 @@ function DesktopArchivedSessionItem({ prStatusMeta, PrIcon, prTooltipLabel, - } = getArchivedSessionItemViewModel(session, now); + } = getArchivedSessionItemViewModel(session, now, gitHubIntegrationAvailable); const handleRowClick = useCallback(() => { if (isMultiSelectMode) { @@ -618,6 +627,7 @@ function MobileArchivedSessionItem({ onEnterMultiSelect, owner, }: MobileArchivedSessionItemProps) { + const gitHubIntegrationAvailable = useAppCapability('githubIntegration'); const { title, relativeTime, @@ -628,7 +638,7 @@ function MobileArchivedSessionItem({ prStatusMeta, PrIcon, prTooltipLabel, - } = getArchivedSessionItemViewModel(session, now); + } = getArchivedSessionItemViewModel(session, now, gitHubIntegrationAvailable); const longPressTimerRef = useRef | null>(null); const longPressFiredRef = useRef(false);