Skip to content

fix: correctly exclude primary version from expanded tag list#1802

Merged
danielroe merged 1 commit intonpmx-dev:mainfrom
mcontrib:fix/versions-tag-expanded-list
Mar 1, 2026
Merged

fix: correctly exclude primary version from expanded tag list#1802
danielroe merged 1 commit intonpmx-dev:mainfrom
mcontrib:fix/versions-tag-expanded-list

Conversation

@maxchang3
Copy link
Contributor

@maxchang3 maxchang3 commented Mar 1, 2026

🔗 Linked issue

Resolves #1789

🧭 Context

When expanding a dist-tag row, versions newer than the dist-tag version could be silently dropped when the dist-tag does not point to the latest version in its major.

📚 Description

Taking @types/node as an example, ts5.1 -> 24.1.0, but the latest 24.x is 24.11.0.

channelVersions is sorted by semver descending, so [0] is always the newest version in the channel, not the dist-tag version:

tagVersions['ts5.1'] = [
  { version: '24.11.0' },  // newest, but NOT the dist-tag version
  { version: '24.10.15' },
  ...
  { version: '24.1.0' },   // actual dist-tag version, shown in row header
]

The old code used .slice(1) to exclude the primary version from the expanded list, assuming [0] was always the primary version. This assumption only holds when the dist-tag points to the latest version in its major.

The fix replaces getFilteredTagVersions + .slice(1) with getExpandedTagVersions, which filters out the primary version by version string match instead of by array position.

Before After

@vercel
Copy link

vercel bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 1, 2026 9:11pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 1, 2026 9:11pm
npmx-lunaria Ignored Ignored Mar 1, 2026 9:11pm

Request Review

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Package/Versions.vue 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Walkthrough

The pull request updates the app/components/Package/Versions.vue component by replacing the getFilteredTagVersions() helper function with a new getExpandedTagVersions() function. The new function accepts an additional primaryVersion parameter and filters out the primary version from the tag's version list before applying any active semver filters. All call sites have been updated to pass the row's primary version to this function, ensuring consistent version filtering behaviour across the component.

Suggested labels

help wanted

Suggested reviewers

  • alexdln
  • danielroe
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code changes directly address the primary requirement in #1789 by excluding the primary version via version-string matching rather than array position.
Out of Scope Changes check ✅ Passed All changes are scoped to the Versions.vue component and directly address the version-filtering issue described in the linked issue.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug fix and its rationale with concrete examples.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@maxchang3 maxchang3 changed the title fix(versions): correctly exclude primary version from expanded tag list fix: correctly exclude primary version from expanded tag list Mar 1, 2026
@danielroe danielroe added this pull request to the merge queue Mar 1, 2026
Merged via the queue into npmx-dev:main with commit 9537d6e Mar 1, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing version(s)

2 participants