Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe RSS generation function in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/blog/src/lib/rss.ts (1)
7-10: Good fix for RSS feed ordering.The sorting logic correctly orders posts by date descending (newest first), which is the expected convention for RSS feeds. Using the spread operator to copy the array before sorting is the right call—
Array.prototype.sort()mutates in place, and you don't want to affect the originalblog.getPages()result elsewhere.One small observation: since the Zod schema uses
z.coerce.date()(seeapps/blog/source.config.ts:22),page.data.dateis already aDateobject. Wrapping it innew Date()again is technically redundant—though it's harmless and acts as defensive coding. The same pattern appears on line 23.If you wanted to tighten this up:
♻️ Optional: Remove redundant Date wrapping
const pages = [...blog.getPages()].sort( (a, b) => - new Date(b.data.date).getTime() - new Date(a.data.date).getTime(), + b.data.date.getTime() - a.data.date.getTime(), );And on line 23:
- const date = new Date(page.data.date); + const date = page.data.date;That said, the current implementation is perfectly functional and achieves the goal.
,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/blog/src/lib/rss.ts` around lines 7 - 10, The comparator in the pages sorting unnecessarily wraps already-coerced Date objects with new Date(); update the sort callback used when creating pages (the spread of blog.getPages()) to compare page.data.date and b.data.date directly (e.g., use b.data.date.getTime() - a.data.date.getTime()) so you remove the redundant new Date() constructions while preserving descending date order.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/blog/src/lib/rss.ts`:
- Around line 7-10: The comparator in the pages sorting unnecessarily wraps
already-coerced Date objects with new Date(); update the sort callback used when
creating pages (the spread of blog.getPages()) to compare page.data.date and
b.data.date directly (e.g., use b.data.date.getTime() - a.data.date.getTime())
so you remove the redundant new Date() constructions while preserving descending
date order.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2178f48d-ac07-4ac7-a647-31efdae35743
📒 Files selected for processing (1)
apps/blog/src/lib/rss.ts
Summary by CodeRabbit