fix(ui): enable live updates for Yesterday section in cockpit#1825
fix(ui): enable live updates for Yesterday section in cockpit#1825
Conversation
The cockpit only live-updated the Today section via SSE events, causing cross-midnight runs in the Yesterday section to show stale status. Split the live-update gate: isToday controls polling fallback, new isLive flag (Today + Yesterday) controls SSE event revalidation. Github-Issue: #1823
📝 WalkthroughWalkthroughThis change enables live updates for both the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ui/src/features/cockpit/hooks/useDateKanbanData.ts (1)
96-104: Query options still useisToday, limiting yesterday's update behavior.The SWR options are based on
isToday, so the yesterday section uses static options (refreshInterval: 0,revalidateOnFocus: false). If the intent is for yesterday to have similar live behavior to today, consider usingisLivehere as well:♻️ Suggested change
{ - ...(isToday + ...(isLive ? liveFallbackOptions(liveState) : { refreshInterval: 0,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/src/features/cockpit/hooks/useDateKanbanData.ts` around lines 96 - 104, The SWR query options branch currently uses isToday to decide whether to call liveFallbackOptions(liveState) or use static options, which prevents yesterday from getting live behavior; update the conditional to use isLive (or include isLive in the condition) instead of isToday so that liveFallbackOptions(liveState) is applied whenever the date is live. Locate the ternary around liveFallbackOptions in useDateKanbanData.ts and replace the isToday check with isLive (or combine isToday || isLive) so that liveFallbackOptions(liveState) is returned for live dates and the static options remain for non-live dates.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ui/src/features/cockpit/hooks/useDateKanbanData.ts`:
- Around line 96-104: The SWR query options branch currently uses isToday to
decide whether to call liveFallbackOptions(liveState) or use static options,
which prevents yesterday from getting live behavior; update the conditional to
use isLive (or include isLive in the condition) instead of isToday so that
liveFallbackOptions(liveState) is applied whenever the date is live. Locate the
ternary around liveFallbackOptions in useDateKanbanData.ts and replace the
isToday check with isLive (or combine isToday || isLive) so that
liveFallbackOptions(liveState) is returned for live dates and the static options
remain for non-live dates.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 11222c44-2acf-4942-b94e-cb01dca4eeb2
📒 Files selected for processing (3)
ui/src/features/cockpit/components/DateKanbanSection.tsxui/src/features/cockpit/components/__tests__/DateKanbanSection.test.tsxui/src/features/cockpit/hooks/useDateKanbanData.ts
Summary
isLiveflag that is true for both Today and Yesterday dates, and passed it touseLiveDAGRunsinstead ofisTodaytodayStrusing a memoizeddayjscalculationisTodayandisLiveflags for today, yesterday, and older datesTesting
cd ui && pnpm test -- --run src/features/cockpit/components/__tests__/DateKanbanSection.test.tsxCloses #1823
Summary by CodeRabbit
Tests
Chores