What's new version fix

This commit is contained in:
Harvey
2026-04-18 02:42:01 +01:00
parent 2d98c5f17d
commit 4736ed4668
2 changed files with 25 additions and 9 deletions
@@ -22,21 +22,32 @@
return m ? m[1] : null;
}
// Collect all releases sharing the same minor version (e.g. v1.3.0, v1.3.1, …)
// Collect releases sharing the same minor version, up to and including the current version
const minorReleases = $derived.by(() => {
const releases = releaseHistoryQuery.data;
if (!releases || releases.length === 0) return [];
const versionToMatch = isDev ? releases[0].tag_name : currentVersion;
if (!versionToMatch) return [];
if (isDev) {
const prefix = getMinorPrefix(releases[0].tag_name);
if (!prefix) return [releases[0]];
return releases.filter((r) => !r.prerelease && getMinorPrefix(r.tag_name) === prefix);
}
const prefix = getMinorPrefix(versionToMatch);
if (!currentVersion) return [];
const prefix = getMinorPrefix(currentVersion);
if (!prefix) {
const exact = releases.find((r) => r.tag_name === versionToMatch);
const exact = releases.find((r) => r.tag_name === currentVersion);
return exact ? [exact] : [];
}
return releases.filter((r) => getMinorPrefix(r.tag_name) === prefix);
// Same minor, then slice from the current version downward (releases are newest-first)
const sameMinor = releases.filter(
(r) => !r.prerelease && getMinorPrefix(r.tag_name) === prefix
);
const currentIdx = sameMinor.findIndex((r) => r.tag_name === currentVersion);
if (currentIdx === -1) return sameMinor;
return sameMinor.slice(currentIdx);
});
$effect(() => {
@@ -31,6 +31,7 @@
);
$effect(() => {
let aborted = false;
const withContent = releases.filter((r) => r.body && r.body.trim());
if (withContent.length === 0) {
renderedSections = [];
@@ -45,11 +46,15 @@
}))
)
.then((sections) => {
renderedSections = sections;
if (!aborted) renderedSections = sections;
})
.catch(() => {
renderedSections = [];
if (!aborted) renderedSections = [];
});
return () => {
aborted = true;
};
});
$effect(() => {
@@ -66,7 +71,7 @@
}
function onDialogClose() {
if (dismissKey) {
if (dismissKey && !isWhatsNewDismissed(dismissKey)) {
dismissWhatsNew(dismissKey);
}
}