From a13f7f18e55429b0d6944e9544baba06fd9399d6 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 23 Apr 2026 16:45:05 +0100 Subject: [PATCH] fix(site): remove last-checked label from git diff panel (#24675) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes `LastCheckedLabel.tsx` component and all related plumbing. Note: chromatic is failing on main, seems to be pre-existing. > 🤖 --- .../AgentsPage/AgentChatPageView.stories.tsx | 1 - .../pages/AgentsPage/AgentChatPageView.tsx | 2 - .../components/GitPanel/GitPanel.stories.tsx | 41 ------ .../components/GitPanel/GitPanel.tsx | 11 -- .../components/GitPanel/LastCheckedLabel.tsx | 32 ----- .../AgentsPage/hooks/useGitWatcher.test.ts | 123 +----------------- .../pages/AgentsPage/hooks/useGitWatcher.ts | 25 +--- 7 files changed, 10 insertions(+), 225 deletions(-) delete mode 100644 site/src/pages/AgentsPage/components/GitPanel/LastCheckedLabel.tsx diff --git a/site/src/pages/AgentsPage/AgentChatPageView.stories.tsx b/site/src/pages/AgentsPage/AgentChatPageView.stories.tsx index d5f63899b1..922fb0434b 100644 --- a/site/src/pages/AgentsPage/AgentChatPageView.stories.tsx +++ b/site/src/pages/AgentsPage/AgentChatPageView.stories.tsx @@ -86,7 +86,6 @@ const buildGitWatcher = (): ComponentProps< >["gitWatcher"] => ({ repositories: new Map(), everDirty: new Set(), - lastCheckedAt: undefined, refresh: fn().mockReturnValue(true), }); diff --git a/site/src/pages/AgentsPage/AgentChatPageView.tsx b/site/src/pages/AgentsPage/AgentChatPageView.tsx index f4d9ab2abc..6a333b5bb9 100644 --- a/site/src/pages/AgentsPage/AgentChatPageView.tsx +++ b/site/src/pages/AgentsPage/AgentChatPageView.tsx @@ -128,7 +128,6 @@ interface AgentChatPageViewProps { gitWatcher: { repositories: ReadonlyMap; everDirty: ReadonlySet; - lastCheckedAt: Date | undefined; refresh: () => boolean; }; @@ -346,7 +345,6 @@ export const AgentChatPageView: FC = ({ } repositories={gitWatcher.repositories} everDirty={gitWatcher.everDirty} - lastCheckedAt={gitWatcher.lastCheckedAt} onRefresh={handleRefresh} onCommit={handleCommit} isExpanded={visualExpanded} diff --git a/site/src/pages/AgentsPage/components/GitPanel/GitPanel.stories.tsx b/site/src/pages/AgentsPage/components/GitPanel/GitPanel.stories.tsx index 7de811aab1..cc775f23f0 100644 --- a/site/src/pages/AgentsPage/components/GitPanel/GitPanel.stories.tsx +++ b/site/src/pages/AgentsPage/components/GitPanel/GitPanel.stories.tsx @@ -389,44 +389,3 @@ export const CleanRepoFromStart: Story = { expect(tabs).toHaveLength(0); }, }; - -/** - * Renders the relative-time label once a scan has been observed. - */ -export const ShowsLastCheckedLabel: Story = { - args: { - repositories: new Map([["/home/coder/coder", makeRepo()]]), - // Fixed past date keeps the rendered "ago" text deterministic - // for pixel snapshots. dayjs formats "X months ago" or "X - // years ago" at this scale, and those buckets do not flip - // between story collection and story render. - lastCheckedAt: new Date("2024-01-01T00:00:00Z"), - }, - play: async ({ canvasElement }) => { - const label = canvasElement.querySelector( - '[data-testid="git-last-checked"]', - ); - expect(label).not.toBeNull(); - // dayjs' relativeTime renders sub-45s as 'a few seconds ago' - // and longer spans as ' ago'. Accept either shape - // so the story is not coupled to dayjs' specific bucketing. - expect(label?.textContent ?? "").toMatch(/^checked .+ ago$/); - }, -}; - -/** - * With no scan observed yet, the label renders nothing so the - * toolbar collapses cleanly. - */ -export const NoLastCheckedYet: Story = { - args: { - repositories: new Map([["/home/coder/coder", makeRepo()]]), - lastCheckedAt: undefined, - }, - play: async ({ canvasElement }) => { - const label = canvasElement.querySelector( - '[data-testid="git-last-checked"]', - ); - expect(label).toBeNull(); - }, -}; diff --git a/site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx b/site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx index bec84d5f68..16413a2043 100644 --- a/site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx +++ b/site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx @@ -29,7 +29,6 @@ import { } from "../DiffViewer/DiffViewer"; import { LocalDiffPanel } from "../DiffViewer/LocalDiffPanel"; import { RemoteDiffPanel } from "../DiffViewer/RemoteDiffPanel"; -import { LastCheckedLabel } from "./LastCheckedLabel"; type GitView = { type: "remote" } | { type: "local"; repoRoot: string }; @@ -63,11 +62,6 @@ interface GitPanelProps { * then reverts it. */ everDirty?: ReadonlySet; - /** - * Timestamp of the last scan received from the server. Rendered as a - * live-updating "checked Ns ago" label next to the refresh button. - */ - lastCheckedAt?: Date | undefined; } function repoTabLabel(repoRoot: string): string { @@ -84,7 +78,6 @@ export const GitPanel: FC = ({ remoteDiffStats, chatInputRef, everDirty, - lastCheckedAt, }) => { const hasRemoteStats = (remoteDiffStats?.additions ?? 0) > 0 || @@ -258,10 +251,6 @@ export const GitPanel: FC = ({ {/* Controls */}
-