fix: docs tab repeats the package name twice in the header - #3101
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughDocs URL construction is centralised in ChangesDocs routing
Sequence Diagram(s)sequenceDiagram
participant PackageUI
participant docsRoute
participant DocsPage
participant usePackageRoute
PackageUI->>docsRoute: Build docs location
docsRoute-->>PackageUI: Return catch-all docs path
DocsPage->>usePackageRoute: Parse docs path
usePackageRoute-->>DocsPage: Return package and requested version
DocsPage->>docsRoute: Build redirect or version location
docsRoute-->>DocsPage: Return updated docs path
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ 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 |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/nuxt/composables/use-package-route.spec.ts (1)
83-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the scoped path shape emitted by
docsRoute.Both tests use
['@vitest/pretty-format', ...]as a single segment, so the new two-segment branch is untested. Add a case using['@vitest', 'pretty-format', 'v', '4.1.10']to verify the parser consumes the actual route produced bydocsRoute.As per coding guidelines, core functionality should have unit tests using Vitest.
🤖 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 `@test/nuxt/composables/use-package-route.spec.ts` around lines 83 - 100, Add a Vitest case in the usePackageRoute test suite covering the two-segment scoped route shape emitted by docsRoute: push params ['`@vitest`', 'pretty-format', 'v', '4.1.10'] and assert packageName is '`@vitest/pretty-format`', requestedVersion is '4.1.10', and orgName is 'vitest'.Source: Coding guidelines
🤖 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.
Inline comments:
In `@app/composables/usePackageRoute.ts`:
- Around line 30-34: The docs-page parser must match the package route contract
used by the parser around splitPackageName: treat “v” as a version marker only
immediately after the complete package prefix, not at the first occurrence
anywhere in the path. Update app/pages/package-docs/[...path].vue to reuse a
shared parser or apply the same scoped-package logic, and add regression
coverage for docsRoute('v', '1.0.0') and docsRoute('`@org/v`', '1.0.0') so both
resolve the package name and version correctly.
---
Nitpick comments:
In `@test/nuxt/composables/use-package-route.spec.ts`:
- Around line 83-100: Add a Vitest case in the usePackageRoute test suite
covering the two-segment scoped route shape emitted by docsRoute: push params
['`@vitest`', 'pretty-format', 'v', '4.1.10'] and assert packageName is
'`@vitest/pretty-format`', requestedVersion is '4.1.10', and orgName is 'vitest'.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ea2b9ac4-2cc1-4e24-bbc8-16935692dfac
📒 Files selected for processing (7)
app/components/Package/Header.vueapp/composables/useCommandPalettePackageCommands.tsapp/composables/usePackageRoute.tsapp/pages/package-docs/[...path].vueapp/utils/router.tstest/nuxt/composables/use-package-route.spec.tstest/unit/app/utils/router.spec.ts
🔗 Linked issue
Resolves #3100
🧭 Context
In #3044, we began showing the version of a package next to its name when viewing
package/<name>/v/<version>. When navigating to the docs tab, scoped packages were instead showing@<org>/<package>/@<org>/<package>📚 Description
Navigating to the
docstabs leads to/package-docs/@vitest%2Fpretty-format/v/4.1.10, not/package-docs/@vitest/pretty-format/v/4.1.10. When the slash is unescaped, the version shows correctly. This PR addresses these two separate issues :/./package-docsroutes consistently to prevent encoding the/in@org/packageBefore:


After: