Skip to content

Commit 779e33d

Browse files
committed
fix(ui): respect semver filter when showing latest tag
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.
1 parent d1b2172 commit 779e33d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/components/Package/Versions.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,18 @@ const visibleTagRows = computed(() => {
210210
getTagVersions(row.tag).some(v => filteredVersionSet.value.has(v.version)),
211211
)
212212
: rowsMaybeFilteredForDeprecation
213-
return rows.slice(0, MAX_VISIBLE_TAGS)
213+
const first = rows.slice(0, MAX_VISIBLE_TAGS)
214+
215+
// When no filter is active, ensure 'latest' is always shown (even if not fully loaded)
216+
if (!isFilterActive.value) {
217+
const latestTagRow = rowsMaybeFilteredForDeprecation.find(row => row.tag === 'latest')
218+
if (latestTagRow && !first.includes(latestTagRow)) {
219+
first.pop()
220+
first.push(latestTagRow)
221+
}
222+
}
223+
224+
return first
214225
})
215226
216227
// Hidden tag rows (all other tags) - shown in "Other versions"

0 commit comments

Comments
 (0)