fix: Add null guards to SupportersTab pickCount and pickStrategy access#342
Conversation
- Use optional chaining for config.supporters?.pickCount - Use optional chaining for config.supporters?.pickStrategy - Add fallback values (2 for pickCount, 'random' for pickStrategy) - Fixes potential crash when config.supporters is undefined Fixes: #324
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded optional chaining and nullish coalescing operators to Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
justn-hyeok
left a comment
There was a problem hiding this comment.
LGTM! Clean, minimal fix. Optional chaining + sensible defaults (?? 2, ?? 'random') consistent with existing patterns.
Summary
This PR fixes the missing null guard issue described in Issue #324.
Problem
In SupportersTab.tsx, lines 130 and 193-194 accessed config.supporters.pickCount and config.supporters.pickStrategy without optional chaining, while other lines in the same component used config.supporters?.pool. This inconsistency could cause a crash if config.supporters is undefined.
Solution
Added optional chaining with fallback values:
Changes
Testing
Fixes: #324
Summary by CodeRabbit