fix: avoid duplicate mock sponsors#918
Conversation
📝 WalkthroughWalkthroughBoth ChangesFix duplicate mock sponsors in 401 fallback
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 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 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)
src/utils/sponsors.functions.ts (1)
222-230: 💤 Low valueConsider extracting the mock sponsor list to a shared constant.
The same mock sponsor array is defined in both
src/utils/sponsors.functions.tsandsrc/server/sponsors.ts. While this duplication is low-risk for fallback data, extracting it to a shared constant would improve maintainability if the list needs updating in the future.🤖 Prompt for 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. In `@src/utils/sponsors.functions.ts` around lines 222 - 230, The mockSponsors array is currently duplicated in two separate files. Extract this array to a shared constant in a central utilities file or constants file that can be imported by both locations, then update the mockSponsors definition in sponsors.functions.ts and its duplicate in sponsors.ts to import and reference this shared constant instead of maintaining separate copies.
🤖 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.
Nitpick comments:
In `@src/utils/sponsors.functions.ts`:
- Around line 222-230: The mockSponsors array is currently duplicated in two
separate files. Extract this array to a shared constant in a central utilities
file or constants file that can be imported by both locations, then update the
mockSponsors definition in sponsors.functions.ts and its duplicate in
sponsors.ts to import and reference this shared constant instead of maintaining
separate copies.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f57a377f-cbba-415b-9b7f-81a740a2e1d8
📒 Files selected for processing (2)
src/server/sponsors.tssrc/utils/sponsors.functions.ts
Fixes #916
This updates the GitHub sponsors fallback data used when credentials are missing.
Previously, the mock sponsor list repeated the same sponsors 20 times each, which could make the sponsor graphic look like it contained many more unique sponsors than it actually did.
The fallback now keeps the same mock sponsors but returns each one only once.
Summary by CodeRabbit