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.
This commit is contained in:
parent
bc20035652
commit
4479e4c0eb
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue