fix(KB): remove redundant Refresh button from Processing Queue

useEmbedJobs already polls every 2s while jobs are active (and 30s when
idle) and auto-invalidates Stored Files when the queue drains. The
manual Refresh button was a no-op signal — it just confuses users who
click it and see no change. Per-job 'last activity Xs ago' lines remain
as the live-recency indicator.

Stacks on feat/kb-job-status-pill (#893) since the Refresh button only
exists in that branch.
This commit is contained in:
Chris Sherwood 2026-05-14 14:52:17 -07:00 committed by Jake Turner
parent cbae48a3c8
commit 5fcbbc5333
1 changed files with 2 additions and 19 deletions

View File

@ -1,7 +1,6 @@
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import useEmbedJobs from '~/hooks/useEmbedJobs' import useEmbedJobs from '~/hooks/useEmbedJobs'
import HorizontalBarChart from './HorizontalBarChart' import HorizontalBarChart from './HorizontalBarChart'
import StyledButton from './StyledButton'
import StyledSectionHeader from './StyledSectionHeader' import StyledSectionHeader from './StyledSectionHeader'
import { import {
JOB_HEALTH_DISPLAY, JOB_HEALTH_DISPLAY,
@ -14,10 +13,9 @@ interface ActiveEmbedJobsProps {
} }
const ActiveEmbedJobs = ({ withHeader = false }: ActiveEmbedJobsProps) => { const ActiveEmbedJobs = ({ withHeader = false }: ActiveEmbedJobsProps) => {
const { data: jobs, invalidate, dataUpdatedAt } = useEmbedJobs() const { data: jobs } = useEmbedJobs()
// Live "last refreshed Xs ago" tick. We re-render every 5s purely to keep // Re-render every 5s to keep per-job "last activity Xs ago" timestamps fresh.
// the relative timestamp current, without touching React Query state.
const [tick, setTick] = useState(() => Date.now()) const [tick, setTick] = useState(() => Date.now())
useEffect(() => { useEffect(() => {
const id = setInterval(() => setTick(Date.now()), 5000) const id = setInterval(() => setTick(Date.now()), 5000)
@ -30,21 +28,6 @@ const ActiveEmbedJobs = ({ withHeader = false }: ActiveEmbedJobsProps) => {
<StyledSectionHeader title="Processing Queue" className="mt-12 mb-4" /> <StyledSectionHeader title="Processing Queue" className="mt-12 mb-4" />
)} )}
{/* Refresh row only shown when at least one job exists so the empty
state stays clean. */}
{jobs && jobs.length > 0 && (
<div className="flex items-center justify-between mb-3 text-sm">
<span className="text-text-muted">
{dataUpdatedAt > 0
? `Last updated ${formatTimeAgo(dataUpdatedAt, tick)}`
: 'Loading…'}
</span>
<StyledButton variant="ghost" size="sm" icon="IconRefresh" onClick={invalidate}>
Refresh
</StyledButton>
</div>
)}
<div className="space-y-4"> <div className="space-y-4">
{jobs && jobs.length > 0 ? ( {jobs && jobs.length > 0 ? (
jobs.map((job) => { jobs.map((job) => {