Skip to content

feat: auto-refresh dashboard, jobs, and processes#20

Merged
eclectic-coding merged 5 commits into
mainfrom
feature/auto-refresh
May 19, 2026
Merged

feat: auto-refresh dashboard, jobs, and processes#20
eclectic-coding merged 5 commits into
mainfrom
feature/auto-refresh

Conversation

@eclectic-coding
Copy link
Copy Markdown
Owner

Summary

  • Adds a refresh Stimulus controller that polls the current page at a configurable interval (default 5 s for dashboard, 10 s for jobs/processes) and swaps the matching <turbo-frame> content without a full page reload
  • Dashboard stat grid and processes table are wrapped in new Turbo frames; jobs index reuses its existing jobs-table frame
  • Polling pauses automatically when the browser tab is hidden and resumes (with an immediate refresh) when the tab becomes visible again
  • Dashboard and processes frames set target="_top" so link clicks break out to full-page navigation rather than targeting the frame

Implementation notes

turbo-frame#reload() is a no-op on server-rendered frames without a src attribute. The controller instead uses fetch() with a Turbo-Frame header, parses the response, and replaces the frame's innerHTML with the matching frame from the response. This avoids any browser history side-effects and works regardless of how the frame was initially rendered.

Test plan

  • Open /jobs dashboard — stat card counts update every 5 s without a browser spinner
  • Create a job in the rails console (SolidQueue::Job.create!(class_name: "TestJob", queue_name: "default", arguments: [])) and watch the Ready counter increment automatically
  • Click a stat card — navigates to the correct filtered view (no "Content missing")
  • Open /jobs/list — table refreshes every 10 s; check DevTools Network for frame requests with Turbo-Frame header
  • Open /jobs/processes — heartbeat timestamps update every 10 s
  • Switch to a different browser tab — Network requests stop; switch back — an immediate refresh fires

🤖 Generated with Claude Code

eclectic-coding and others added 4 commits May 19, 2026 11:56
Adds a `refresh` Stimulus controller that calls `turbo-frame#reload()` on a
configurable interval (default 5 s). The timer resets after each frame load
completes and is paused while the browser tab is hidden, so background tabs
don't generate unnecessary requests.

Wired to:
- Dashboard stat grid (5 s) — reflects changing job counts in real time
- Jobs index table (10 s) — already inside a turbo-frame; just adds the controller
- Processes table (10 s) — wrapped in a new turbo-frame; keeps heartbeat status current

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ribute

turbo-frame#reload() is a no-op when the frame has no src attribute, which
is the case for all server-rendered frames here. Replace with a direct fetch
that sends the Turbo-Frame header and swaps the matching frame's innerHTML.
Timer reschedules after each tick regardless of success/failure; pauses while
the tab is hidden.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Links inside a turbo-frame target the frame by default; without a matching
frame on the destination page, Turbo renders "Content missing". Setting
target="_top" on the dashboard and processes frames makes all link clicks
break out to a full-page navigation while leaving the fetch-based auto-refresh
unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The dummy app had no bin/ directory, making it impossible to run
`bin/rails console` or `bin/rails server` from spec/dummy directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (57c8693) to head (8f74736).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #20   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12        12           
  Lines          185       185           
=========================================
  Hits           185       185           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit 1f7f44e into main May 19, 2026
5 checks passed
@eclectic-coding eclectic-coding deleted the feature/auto-refresh branch May 19, 2026 16:22
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