Skip to content

Commit 72bb755

Browse files
committed
Show go to latest for prereleases, closes #2173
1 parent 6db9cab commit 72bb755

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

assets/js/sidebar/sidebar-version-select.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ if (!isEmbedded) {
3030
}))
3131

3232
const latestVersionNode = versionNodes.find(node => node.latest)
33-
const latestVersion = latestVersionNode?.version !== currentVersion && !currentVersion.includes('-') ? latestVersionNode?.url : null
33+
let latestVersion = latestVersionNode?.version !== currentVersion ? latestVersionNode?.url : null
34+
35+
// Prereleases are not marked as latest. So if we have a prerelease
36+
// and it appears before the latest version, we reset latestVersion
37+
if (currentVersion.includes('-') &&
38+
versionNodes.findIndex(n => n.version === currentVersion) < versionNodes.findIndex(node => node.latest)) {
39+
latestVersion = null
40+
}
3441

3542
versionsContainer.innerHTML = versionsDropdownTemplate({ nodes, latestVersion})
3643

formatters/html/dist/html-HBZYRXZS.js renamed to formatters/html/dist/html-XBCM4BHM.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)