feat: auto-refresh dashboard, jobs, and processes#20
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
refreshStimulus 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 reloadjobs-tableframetarget="_top"so link clicks break out to full-page navigation rather than targeting the frameImplementation notes
turbo-frame#reload()is a no-op on server-rendered frames without asrcattribute. The controller instead usesfetch()with aTurbo-Frameheader, parses the response, and replaces the frame'sinnerHTMLwith 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
/jobsdashboard — stat card counts update every 5 s without a browser spinnerSolidQueue::Job.create!(class_name: "TestJob", queue_name: "default", arguments: [])) and watch the Ready counter increment automatically/jobs/list— table refreshes every 10 s; check DevTools Network for frame requests withTurbo-Frameheader/jobs/processes— heartbeat timestamps update every 10 s🤖 Generated with Claude Code