Skip to content

Dashboard: fix training list flicker between empty state and actual runs#170

Open
kevinlu1248 wants to merge 1 commit into
modal-projects:mainfrom
kevinlu1248:dashboard-empty-runs-flicker-fix
Open

Dashboard: fix training list flicker between empty state and actual runs#170
kevinlu1248 wants to merge 1 commit into
modal-projects:mainfrom
kevinlu1248:dashboard-empty-runs-flicker-fix

Conversation

@kevinlu1248

Copy link
Copy Markdown
Contributor

Problem

The training runs list alternates between "No training runs found yet." and showing the actual jobs every few seconds.

Root cause

GET /runs reads from a Modal volume that can momentarily list empty during a reload, returning a 200 with []. fetchRuns only throws on a non-OK HTTP status, so an empty-but-successful response flows through, and the 5s auto-refresh runs allRuns = []. The list flips to the empty state, then repopulates on the next poll — hence the flicker.

Fix

Treat a lone empty /runs response as transient when we already have runs: ignore it for up to EMPTY_RUNS_TOLERANCE (3) consecutive polls and keep the current rows. This mirrors the existing catch-block behavior that preserves data on transient failures.

  • A genuinely persistent empty (real reset) is still accepted once it sticks past the tolerance.
  • A cold start with no prior data still shows the empty state immediately (the guard only applies when allRuns.length > 0).

Testing

npm run build passes (only pre-existing unused-CSS warnings, unrelated).

🤖 Generated with Claude Code

The /runs endpoint reads from a Modal volume that can momentarily list empty
during a reload, returning a 200 with []. fetchRuns doesn't throw on that, so
the auto-refresh would set allRuns = [], flashing "No training runs found yet."
and then repopulating on the next 5s poll.

Treat a lone empty response as transient when we already have runs: ignore it
for up to EMPTY_RUNS_TOLERANCE consecutive polls and keep the current rows. A
genuinely persistent empty (real reset) is still accepted once it sticks, and a
cold start with no prior data still shows the empty state immediately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant