Skip to content

Commit 6ddc3d0

Browse files
committed
fix: hide stale eta on cancelled jobs
1 parent d734d4d commit 6ddc3d0

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/components/generation/GenerationPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export function GenerationPanel() {
3232
<>
3333
<div className="flex-1 flex items-center gap-2 overflow-x-auto text-xs">
3434
{visibleJobs.map((job) => {
35-
const eta = formatEtaDisplay(job.etaSeconds ?? null);
36-
const progressPercent = Math.round(job.progressPercent ?? 0);
3735
const isActive = job.status === 'queued' || job.status === 'generating' || job.status === 'processing';
36+
const eta = isActive ? formatEtaDisplay(job.etaSeconds ?? null) : '';
37+
const progressPercent = Math.round(job.progressPercent ?? 0);
3838
const isRetryable = (job.status === 'error' || job.status === 'cancelled') && !!job.retryParams;
3939

4040
// Queue position from stable precomputed map

src/components/generation/__tests__/GenerationPanel.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ describe('GenerationPanel', () => {
121121
expect(screen.getByText('Cancelled')).toBeDefined();
122122
});
123123

124+
it('does not show stale ETA for cancelled jobs', () => {
125+
const job = createJob({
126+
id: 'gen-cancelled',
127+
trackName: 'Pad',
128+
status: 'cancelled' as GenerationJob['status'],
129+
etaSeconds: 30,
130+
});
131+
useGenerationStore.getState().addJob(job);
132+
133+
render(<GenerationPanel />);
134+
135+
expect(screen.queryByText(/ETA/)).toBeNull();
136+
});
137+
124138
it('shows Cancel All button when 2+ active jobs', () => {
125139
useGenerationStore.getState().addJob(createJob({ id: 'j1', status: 'generating' }));
126140
useGenerationStore.getState().addJob(createJob({ id: 'j2', status: 'queued' }));

0 commit comments

Comments
 (0)