From 4479e4c0eb65f4d40618413f6da2da9c94b58ca3 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Tue, 14 Apr 2026 10:33:25 -0700 Subject: [PATCH] fix: use >= in compareVersions fallback to handle equal/unparseable versions (#635) compareVersions returns 0 for both genuinely equal versions and unparseable strings. In the localIndex === -1 fallback path, skipping on >= 0 (instead of just > 0) avoids showing stale rich cards when the version relationship is ambiguous. --- src/main/updater-changelog.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/updater-changelog.ts b/src/main/updater-changelog.ts index a33e5b28b..90f05c456 100644 --- a/src/main/updater-changelog.ts +++ b/src/main/updater-changelog.ts @@ -106,8 +106,14 @@ export async function fetchChangelog( if (localIndex < i) { continue } - } else if (compareVersions(localVersion, candidate.version) > 0) { - // localVersion is newer than this candidate — user already passed it. + } else if (compareVersions(localVersion, candidate.version) >= 0) { + // localVersion is newer than (or same as) this candidate — user already + // passed it. Why >=: compareVersions returns 0 both for genuinely equal + // versions and for unparseable strings. In the localIndex === -1 path, + // equal means localVersion literally matches the candidate but wasn't + // found by findIndex (shouldn't happen), and unparseable means we can't + // determine the relationship. Either way, skipping is the safe default + // to avoid showing stale content. continue }