Skip to content

fix(ui): enable live updates for Yesterday section in cockpit#1825

Merged
yottahmd merged 1 commit intomainfrom
issue-1823-cockpit-should-live-update-yesterday-and
Mar 22, 2026
Merged

fix(ui): enable live updates for Yesterday section in cockpit#1825
yottahmd merged 1 commit intomainfrom
issue-1823-cockpit-should-live-update-yesterday-and

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented Mar 22, 2026

Summary

  • The cockpit's Yesterday section was not receiving live updates because only the Today section had SSE polling enabled
  • Added an isLive flag that is true for both Today and Yesterday dates, and passed it to useLiveDAGRuns instead of isToday
  • Computed yesterday's date from todayStr using a memoized dayjs calculation
  • Added unit tests verifying the correct isToday and isLive flags for today, yesterday, and older dates

Testing

  • cd ui && pnpm test -- --run src/features/cockpit/components/__tests__/DateKanbanSection.test.tsx

Closes #1823

Summary by CodeRabbit

  • Tests

    • Added test coverage for date-based Kanban board functionality.
  • Chores

    • Optimized date computation performance and improved internal code efficiency.

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
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 22, 2026

📝 Walkthrough

Walkthrough

This change enables live updates for both the Yesterday and Today sections in the cockpit by computing an isLive flag that includes yesterday's date, then passing it to the hook that controls live DAG run fetching instead of only using the isToday flag.

Changes

Cohort / File(s) Summary
Live Update Logic
ui/src/features/cockpit/components/DateKanbanSection.tsx, ui/src/features/cockpit/hooks/useDateKanbanData.ts
Added useMemo to derive yesterdayStr; expanded useDateKanbanData call signature to pass new isLive parameter computed as `isToday
Test Coverage
ui/src/features/cockpit/components/__tests__/DateKanbanSection.test.tsx
New test suite for DateKanbanSection with mocked useDateKanbanData hook; includes three test cases verifying correct isToday and isLive flag computation for today, yesterday, and older dates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: enabling live updates for the Yesterday section in the cockpit UI component.
Linked Issues check ✅ Passed All coding requirements from issue #1823 are met: isLive flag added to track Today and Yesterday, memoized yesterday date computed, live updates now triggered for both sections, and unit tests verify correct behavior.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue: DateKanbanSection computes isLive flag, useDateKanbanData signature updated to accept isLive, and tests verify the implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-1823-cockpit-should-live-update-yesterday-and

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
ui/src/features/cockpit/hooks/useDateKanbanData.ts (1)

96-104: Query options still use isToday, 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 using isLive here 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

📥 Commits

Reviewing files that changed from the base of the PR and between c33cb46 and 5493286.

📒 Files selected for processing (3)
  • ui/src/features/cockpit/components/DateKanbanSection.tsx
  • ui/src/features/cockpit/components/__tests__/DateKanbanSection.test.tsx
  • ui/src/features/cockpit/hooks/useDateKanbanData.ts

@yottahmd yottahmd merged commit 39429c1 into main Mar 22, 2026
2 checks passed
@yottahmd yottahmd deleted the issue-1823-cockpit-should-live-update-yesterday-and branch March 22, 2026 08:19
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.

Cockpit should live-update Yesterday and Today sections

1 participant