fix: Cannot read properties of undefined (reading 'format')#3
fix: Cannot read properties of undefined (reading 'format')#3
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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 |
Automated fix by Exterminator
Error: Cannot read properties of undefined (reading 'format')
Source:
Location: Line 0, Col 0
Fix summary
In
formatNode,node.metadata!.formatused a TypeScript non-null assertion that suppressed compile-time warnings, butmetadatais genuinelyundefinedat runtime for non-completed tasks (set explicitly incollectMetrics) and for the root aggregate node (which has nometadataproperty), causing a TypeError when any such node is visited during recursive tree formatting.Replaced the unsafe non-null assertion
node.metadata!.formatwith optional chaining and a nullish fallback:node.metadata?.format ?? "pending"in theformatNodefunction. This ensures that whenmetadataisundefined— for incomplete tasks or the synthetic root node — the format label safely defaults to"pending"instead of throwing a TypeError. No other code was changed.Changed files
src/pages/Dashboard.tsx