fix(schedules): keep cached reports visible after polling errors

This commit is contained in:
Chris Scott committed 2026-09-29 11:10:07 -04:00
1 parent eb40a04353
commit b53f192830
2 files changed
+15 -1

No files matched your search

+1 -1
View File
@@ -342,7 +342,7 @@ export function GlobalSchedules() {
const selectedRunMissing = runId !== null && selectedRunInHistory === null
const selectedRunLookupLoading = selectedRunMissing && selectedRunLoading
const selectedRunLookupError = selectedRunMissing && selectedRunError
const selectedRunLookupError = selectedRunMissing && selectedRunError && selectedRun === null
const selectedRunLookupNotFound = selectedRunMissing && !selectedRunLoading && !selectedRunError && selectedRun === null
return (
@@ -205,6 +205,20 @@ describe('GlobalSchedules run history', () => {
expect(selectRun).toHaveBeenCalledWith(null)
})
it('renders the cached selected run when a background refetch fails', () => {
selectedRunResult = { data: [makeRun({ id: 999, sessionTitle: 'Deep linked run' })], isLoading: false, isError: true }
mocks.useScheduleUrlState.mockReturnValue(createMockScheduleUrlState({ scheduleTab: 'runs', runId: 999 }))
renderGlobalSchedules()
expect(screen.queryByText('Failed to load run')).not.toBeInTheDocument()
expect(screen.queryByText('Run not found')).not.toBeInTheDocument()
expect(mocks.RunHistoryCards).toHaveBeenCalled()
const props = runHistoryProps()
expect(props.selectedRunId).toBe(999)
expect(props.runs.filter((run) => run.id === 999)).toHaveLength(1)
})
it('re-queries when the selected run id changes', () => {
mainRunsResult = { data: [], isLoading: false }
selectedRunResult = { data: [makeRun({ id: 999 })], isLoading: false, isError: false }