Skip to content

Update workflow status in place without a page reload - #11

Merged
7174Andy merged 2 commits into
mainfrom
progress-refresh
Aug 2, 2026
Merged

Update workflow status in place without a page reload#11
7174Andy merged 2 commits into
mainfrom
progress-refresh

Conversation

@7174Andy

@7174Andy 7174Andy commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Problem

Schedule status only updated on a manual browser reload. Watching a dispatched run meant hitting refresh over and over.

Approach

Poll getSchedules() every 10s while any schedule is non-terminal — pending, processing, or triggered with no conclusion yet. When everything has settled, no timer starts and no requests are issued.

10s is deliberate, not arbitrary: the cron tick that writes these rows runs once a minute, so the badge is at most ~70s behind the real GitHub run regardless. Polling faster buys nothing.

Adds a Refresh button, and an updating… indicator beside the Pending and History headers that shows for the background poll as well as the manual click.

Details worth a look in review

  • fetchSchedules holds the in-flight promise, not a boolean. Overlapping calls collapse onto one request, so a slow response can't land after a newer one and repaint running… over an already-resolved succeeded. A click racing the poll timer still awaits a real result rather than no-op'ing.
  • 400ms floor on the indicator. A schedule read finishes well under 100ms, so without it the indicator flashes for a single frame every poll — jitter, not feedback. Data still renders the moment it arrives.
  • The indicator is aria-hidden. It repeats every 10s; a live region announcing it that often would bury the badge change that actually matters. Happy to reverse this if you'd rather it announce.
  • The Refresh button is not disabled while fetching. The promise dedupe already collapses concurrent clicks, and disabling it would grey the button out every 10s on its own.

Trade-off

A tab left open with a schedule days out polls every 10s the whole time. An earlier version slept until the schedule came due, but that cost ~77 lines (a helper module, a now state, a two-branch timer) to optimise a case that only bites if you leave a tab open for days. Cut it deliberately.

Testing

npx tsc --noEmit clean, npx eslint . clean, npx vitest run 84 passing.

No automated coverage for the polling itself — it's useEffect timer behavior with no test harness for components in this repo (vitest runs in node, no DOM). Verified by hand in the running dev app.

🤖 Generated with Claude Code

Schedule status only changed on a manual browser refresh, so watching a
dispatched run meant reloading the page repeatedly.

Poll getSchedules() every 10s while any schedule is non-terminal - pending,
processing, or triggered with no conclusion yet. Once everything has settled
no timer is started and no requests are issued. Polling faster would not help:
the cron tick that writes these rows runs once a minute, so the badge is at
most ~70s behind the GitHub run either way.

Also adds a Refresh button and an "updating…" indicator beside the Pending and
History headers, shown for the background poll as well as the manual click.

Two details worth noting:

- fetchSchedules holds the in-flight promise rather than a boolean, so
  overlapping calls collapse onto one request. A slow response can therefore
  never land after a newer one and repaint "running…" over an already-resolved
  "succeeded", and a click racing the poll timer still awaits a real result.
- The indicator is held for a 400ms floor. A schedule read finishes well under
  100ms, so without it the indicator would flash for a single frame every poll.
  Data still renders as soon as it arrives.

The indicator is aria-hidden: it repeats every 10s, and a live region
announcing it that often would bury the badge change that actually matters.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gitcron Ready Ready Preview Aug 2, 2026 2:28am

@7174Andy
7174Andy merged commit 7341509 into main Aug 2, 2026
5 checks passed
@7174Andy
7174Andy deleted the progress-refresh branch August 2, 2026 02:29
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