fix: show changelog notice when stored version is missing or older
This commit is contained in:
parent
370944f443
commit
3914ea9b71
|
|
@ -25,20 +25,17 @@ export function ChangelogNotification() {
|
||||||
// localStorage unavailable
|
// localStorage unavailable
|
||||||
}
|
}
|
||||||
|
|
||||||
// First-time visitor: record the version silently, nothing to announce.
|
const isOutdated =
|
||||||
if (storedVersion === null) {
|
storedVersion === null ||
|
||||||
try {
|
storedVersion.localeCompare(latest.version, undefined, {
|
||||||
localStorage.setItem(STORAGE_KEY, latest.version);
|
numeric: true,
|
||||||
} catch {
|
}) < 0;
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Already seen this version.
|
// TODO(v0.4): revert to the standard "null = first-time visitor, record silently"
|
||||||
if (storedVersion === latest.version) return;
|
// path. The null case intentionally shows the card for this release so existing
|
||||||
|
// users who never had the key get the 0.3.0 announcement.
|
||||||
|
if (!isOutdated) return;
|
||||||
|
|
||||||
// New version since last visit: record it and show the notification.
|
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(STORAGE_KEY, latest.version);
|
localStorage.setItem(STORAGE_KEY, latest.version);
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue