Skip to content

fix(ui): respect semver filter when showing latest tag#2389

Merged
ghostdevv merged 2 commits intonpmx-dev:mainfrom
joshuaisaact:fix/semver-range-filter-latest-tag
Apr 5, 2026
Merged

fix(ui): respect semver filter when showing latest tag#2389
ghostdevv merged 2 commits intonpmx-dev:mainfrom
joshuaisaact:fix/semver-range-filter-latest-tag

Conversation

@joshuaisaact
Copy link
Copy Markdown
Contributor

The 'latest' tag was unconditionally added to visible results even when it didn't match the active semver filter.

This caused versions like 7.6.0 to appear when filtering by ranges like '^7.5 <7.6'.

Remove the special case handling for the 'latest' tag and let it flow naturally through the filtering logic.

This makes the behaviour predictable and fixes the bug where non-matching versions were displayed.

🔗 Linked issue

Fixes issue #2340

🧭 Context

We gave 'latest' releases special handling in the semver filter, which meant they always appeared in certain circumstances.

📚 Description

Fixes the linked bug. Also simplifies the code - not sure why we gave latest versions special treatment.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 5, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 5, 2026 6:23pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 5, 2026 6:23pm
npmx-lunaria Ignored Ignored Apr 5, 2026 6:23pm

Request Review

The 'latest' tag was unconditionally added to visible results even when
it didn't match the active semver filter. This caused versions like 7.6.0
to appear when filtering by ranges like '^7.5 <7.6'.

Remove the special case handling for the 'latest' tag and let it flow
naturally through the filtering logic. This makes the behavior more
predictable and fixes the bug where non-matching versions were displayed.
@joshuaisaact joshuaisaact force-pushed the fix/semver-range-filter-latest-tag branch from 9fe7204 to d1b2172 Compare April 5, 2026 10:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7cc49ea0-234c-44d1-a1c2-309bb25ccfe2

📥 Commits

Reviewing files that changed from the base of the PR and between d1b2172 and 4e6c0c7.

📒 Files selected for processing (1)
  • app/components/Package/Versions.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/Package/Versions.vue

📝 Walkthrough

Walkthrough

The Versions component's visible-tag logic was changed so the "always show latest" special-case only runs when no semver filter is active. When a semver filter is active, visibleTagRows is now a straight slice of the first MAX_VISIBLE_TAGS entries from the filtered rows, allowing latest to be excluded if it doesn't match the filter. A test was added to verify latest can be filtered out when its version doesn't satisfy the semver range.

Possibly related PRs

  • npmx-dev/npmx.dev PR 1912: Also updates semver-filtered version visibility and tag-row handling in Versions.vue, affecting related tag visibility behaviour.
  • npmx-dev/npmx.dev PR 1405: Earlier changes to Versions.vue semver filtering and tag-row logic that this PR further adjusts by narrowing the "latest" inclusion rule.

Suggested labels

front, needs review

Suggested reviewers

  • danielroe
  • ghostdevv
  • shuuji3
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the removal of special-case handling for the 'latest' tag in semver filtering.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

The 'latest' tag was unconditionally added to visible results even when
it didn't match the active semver filter. This caused versions like 7.6.0
to appear when filtering by ranges like '^7.5 <7.6'.

Keep the original behaviour of always showing latest when no filter is
active (important for incomplete version loads), but respect the filter
when one is active.
@ghostdevv ghostdevv added this pull request to the merge queue Apr 5, 2026
Merged via the queue into npmx-dev:main with commit 051f8a7 Apr 5, 2026
20 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.

3 participants