mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-06-05 02:49:06 +02:00
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:
parent
a0047c1555
commit
4e8caddcc2
|
|
@ -1,7 +1,6 @@
|
|||
import { useEffect, useState } from 'react'
|
||||
import useEmbedJobs from '~/hooks/useEmbedJobs'
|
||||
import HorizontalBarChart from './HorizontalBarChart'
|
||||
import StyledButton from './StyledButton'
|
||||
import StyledSectionHeader from './StyledSectionHeader'
|
||||
import {
|
||||
JOB_HEALTH_DISPLAY,
|
||||
|
|
@ -14,10 +13,9 @@ interface 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
|
||||
// the relative timestamp current, without touching React Query state.
|
||||
// Re-render every 5s to keep per-job "last activity Xs ago" timestamps fresh.
|
||||
const [tick, setTick] = useState(() => Date.now())
|
||||
useEffect(() => {
|
||||
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" />
|
||||
)}
|
||||
|
||||
{/* 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">
|
||||
{jobs && jobs.length > 0 ? (
|
||||
jobs.map((job) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user