feat(production): live machine status on all three surfaces - #16
Conversation
Machine Management, the machine detail page and the Production Overview all showed a snapshot taken when the page rendered. The list was worse than frozen - it read persisted rows that only moved when somebody pressed Sync, so it could be hours behind the printer. All three now poll, via one hook so the cadence is a single decision rather than three that drift. It follows the pattern design-detail.tsx already established: seed initialData from the server render, poll a server action rather than a bare fetch, and vary the interval by state. 10s while something is happening on the bed, 30s when nothing is - backed off rather than stopped, because an operator who starts a print from the printer's own touchscreen would otherwise sit in front of a page reading "Ready to print" indefinitely. Seeding from the RSC render means no loading flash and no empty first paint, and refetchIntervalInBackground stays at its default so a backgrounded tab polls nothing at all. The list and Overview read persisted rows, not BambuBuddy: the backend's new periodic sync keeps those current, so their cost is a Postgres read regardless of how many people are watching. Only the detail page reads through to the printer, and the backend caches that. AutoRefresh is removed from the machines page - it router.refresh()es the whole RSC tree, which alongside a query polling the same endpoint is two mechanisms fetching the same data at overlapping intervals. Left in place on batches and jobs, which have no query layer yet. Three components became client components purely to poll; their markup is unchanged. FleetMachineSummaryCard and FleetMachineLiveCard needed no edits at all - they were already pure props components, which is what made this a prop swap rather than a rewrite. The queue board deliberately does not poll: it has drag state a refresh would fight. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Machine Management, the machine detail page and the Production Overview all showed a snapshot taken when the page rendered. The list was worse than frozen — it read persisted rows that only moved when somebody pressed Sync, so it could be hours behind the printer.
All three now poll, via one hook (
hooks/use-fleet-poll.ts) so the cadence is a single decision rather than three that drift apart. Follows the patterndesign-detail.tsxalready established: seedinitialDatafrom the server render, poll a server action rather than a barefetch, vary the interval by state.Cadence
10s while something is happening on the bed, 30s when nothing is — backed off rather than stopped, because an operator who starts a print from the printer's own touchscreen would otherwise sit in front of a page reading "Ready to print" indefinitely.
Seeding from the RSC render means no loading flash and no empty first paint.
refetchIntervalInBackgroundstays at its default, so a backgrounded tab polls nothing at all.Where the data comes from
The list and Overview read persisted rows, not BambuBuddy — the backend's new periodic sync keeps those current, so their cost is a Postgres read regardless of viewer count. Only the detail page reads through to the printer, and the backend caches that (Tensor-Core#10).
AutoRefresh
Removed from the machines page: it
router.refresh()es the whole RSC tree, which alongside a query polling the same endpoint is two mechanisms fetching the same data at overlapping intervals. Left in place on batches and jobs, which have no query layer yet.Scope of the change
Three components became client components purely to poll; their markup is unchanged.
FleetMachineSummaryCardandFleetMachineLiveCardneeded no edits at all — already pure props components, which is what made this a prop swap rather than a rewrite. The queue board deliberately does not poll: it has drag state a refresh would fight.Requires Tensor-Core#10.
🤖 Generated with Claude Code