Fix rundown view crash when tTimers or studio settings are missing - #5
Conversation
Playlists created before the T-timers feature may not have a tTimers field in MongoDB, causing RundownHeaderTimers to crash when calling .filter() on undefined. Similarly, studios that have not run recent migrations may be missing packageContainerSettingsWithOverrides and other ObjectWithOverrides fields, causing server publications to throw when reading .defaults. - Add getRundownTTimers() helper with DEFAULT_RUNDOWN_T_TIMERS fallback - Guard RundownHeaderTimers and getDefaultTTimer against undefined input - Make applyAndValidateOverrides tolerate undefined/null/invalid objects
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds a ChangesTTimer Null-Safety
ObjectWithOverrides Null-Safety
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
ELI5: Any Issues with the Code?The Good News: There are no critical issues here. This is defensive programming at its best! 🛡️ What's happening (in simple terms): The code is like giving functions a safety net. Before, these functions expected you to always pass them a proper value—like handing them a timer tuple or configuration object. If you accidentally passed Now? The functions say "Okay, I see you've got Why it matters: Real-world code can be messy. Data comes from APIs, databases, or complex logic, and sometimes things are 🚥 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✨ Simplify code
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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/webui/src/client/ui/RundownView/RundownHeader/RundownHeaderTimers.tsx`:
- Line 20: The activeTimers variable assignment has a method chain that Prettier
wants formatted on multiple lines for better readability. In the line where
activeTimers is defined with the getRundownTTimers(tTimers).filter((t) =>
t.mode).slice(0, 2) chain, break the method calls onto separate lines with
proper indentation so that each method call in the chain starts on its own line.
- Around line 1-4: The import statement for RundownTTimer and getRundownTTimers
from the TTimers module is split across multiple lines, which Prettier requires
to be on a single line. Consolidate the import statement so that the opening
brace, all imported items (type RundownTTimer and getRundownTTimers), closing
brace, and the from clause with the full module path are all on a single line
without line breaks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d577df38-712b-4d91-a771-1b3a688d9b93
📒 Files selected for processing (5)
packages/corelib/src/dataModel/RundownPlaylist/TTimers.tspackages/corelib/src/settings/__tests__/objectWithOverrides.spec.tspackages/corelib/src/settings/objectWithOverrides.tspackages/webui/src/client/lib/tTimerUtils.tspackages/webui/src/client/ui/RundownView/RundownHeader/RundownHeaderTimers.tsx
Playlists created before the T-timers feature may not have a tTimers field in MongoDB, causing RundownHeaderTimers to crash when calling .filter() on undefined.
Similarly, studios that have not run recent migrations may be missing packageContainerSettingsWithOverrides and other ObjectWithOverrides fields, causing server publications to throw when reading .defaults.
About the Contributor
Type of Contribution
This is a:
Bug fix / Feature / Code improvement / Documentation improvement / Other (please specify)
Current Behavior
New Behavior
Testing
Affected areas
Time Frame
Other Information
Status
Summary by CodeRabbit