Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughBumped Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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. ✨ Finishing Touches📝 Generate docstrings
🧪 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 (2)
test/nuxt/content.spec.ts (1)
123-155: Add one non-v4 test case to validateversionPathbranching.Right now only
'/docs/4.x'is covered. A'/docs/5.x'(or'/docs/3.x') case would lock expected behavior and prevent regressions.Suggested test addition
+ it('should keep non-v4 version paths unmodified', () => { + const page = { value: { path: '/docs/5.x/api/composables/use-fetch' } } as any + const navigation = { + value: [ + { + title: 'Docs', + path: '/docs/5.x', + stem: 'docs/5.x', + children: [ + { + title: 'API', + titleTemplate: '%s · Nuxt API v5', + path: '/docs/5.x/api', + stem: 'docs/5.x/4.api' + } + ] + } + ] + } as any + const result = findTitleTemplate(page, navigation, '/docs/5.x') + expect(result).toBe('%s · Nuxt API v5') + })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/nuxt/content.spec.ts` around lines 123 - 155, Add a second test case that exercises the non-v4 branch of findTitleTemplate by duplicating the existing spec but using a different versionPath (e.g., '/docs/5.x' or '/docs/3.x') for both the page.value.path and all navigation.path/stem entries, then call findTitleTemplate(page, navigation, '/docs/5.x') and assert the same expected title template ('%s · Nuxt Composables'); this will validate the versionPath branching in findTitleTemplate and prevent regressions.app/utils/content.ts (1)
39-41: Gate path normalization byisV4to keepversionPathbehavior explicit.At Line 39-41,
isV4is computed but normalization still runs unconditionally. Making cleaning conditional keeps behavior aligned with the newversionPathparameter and avoids accidental cross-version path collapsing.Proposed refactor
function cleanNavigationPaths(navigation: ContentNavigationItem[], isV4: boolean): ContentNavigationItem[] { return navigation.map(item => ({ ...item, - path: item.path ? cleanV4Path(item.path) : item.path, + path: item.path ? (isV4 ? cleanV4Path(item.path) : item.path) : item.path, children: item.children ? cleanNavigationPaths(item.children, isV4) : undefined })) } @@ const isV4 = versionPath === '/docs/4.x' - const searchPath = cleanV4Path(page.value.path) + const searchPath = isV4 ? cleanV4Path(page.value.path) : page.value.path const cleanNavigation = cleanNavigationPaths(navigation.value, isV4)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/utils/content.ts` around lines 39 - 41, The code always applies V4 normalization even when versionPath isn't '/docs/4.x'; change the behavior so normalization is gated by isV4: compute isV4 as before, then only call cleanV4Path(page.value.path) when isV4 is true (otherwise use page.value.path directly) and only call cleanNavigationPaths(navigation.value, isV4) when isV4 is true (otherwise use navigation.value as-is); update the searchPath and cleanNavigation variables accordingly so cross-version path collapsing is avoided.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/utils/content.ts`:
- Around line 39-41: The code always applies V4 normalization even when
versionPath isn't '/docs/4.x'; change the behavior so normalization is gated by
isV4: compute isV4 as before, then only call cleanV4Path(page.value.path) when
isV4 is true (otherwise use page.value.path directly) and only call
cleanNavigationPaths(navigation.value, isV4) when isV4 is true (otherwise use
navigation.value as-is); update the searchPath and cleanNavigation variables
accordingly so cross-version path collapsing is avoided.
In `@test/nuxt/content.spec.ts`:
- Around line 123-155: Add a second test case that exercises the non-v4 branch
of findTitleTemplate by duplicating the existing spec but using a different
versionPath (e.g., '/docs/5.x' or '/docs/3.x') for both the page.value.path and
all navigation.path/stem entries, then call findTitleTemplate(page, navigation,
'/docs/5.x') and assert the same expected title template ('%s · Nuxt
Composables'); this will validate the versionPath branching in findTitleTemplate
and prevent regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e38c1c52-0f61-45fc-8a45-39db2f92c4f9
📒 Files selected for processing (3)
app/pages/docs/[...slug].vueapp/utils/content.tstest/nuxt/content.spec.ts
🔗 Linked issue
📚 Description
this bumps us to nuxt v4.4