fix(changelog): strip build suffixes before version lookup
UI-lab builds append a suffix to the version string (e.g. "0.1.1-ui") which caused getChangelogForVersion to find no match and fall back to the "not available in-app" message. A regex now strips any hyphen-and-letter suffix before the lookup so the What's New modal renders correctly in all build modes.
This commit is contained in:
+3
-1
@@ -105,7 +105,9 @@ const ENTRIES = parseChangelog(changelogRaw);
|
||||
|
||||
export function getChangelogForVersion(version: string | null | undefined): ChangelogEntry | null {
|
||||
if (!version) return null;
|
||||
const normalized = version.replace(/^v/, "");
|
||||
// Strip leading "v" and any build suffix (e.g. "-ui", "-dev", "-beta.1") so
|
||||
// dev/UI-lab builds still resolve to the correct changelog entry.
|
||||
const normalized = version.replace(/^v/, "").replace(/-[a-z].*/i, "");
|
||||
// Never surface the in-progress [Unreleased] section to users.
|
||||
if (normalized.toLowerCase() === "unreleased") return null;
|
||||
return ENTRIES.find((e) => e.version.replace(/^v/, "") === normalized) ?? null;
|
||||
|
||||
Reference in New Issue
Block a user