Skip to content

Commit 3914ea9

Browse files
committed
fix: show changelog notice when stored version is missing or older
1 parent 370944f commit 3914ea9

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

apps/web/src/lib/changelog/components/changelog-notification.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,17 @@ export function ChangelogNotification() {
2525
// localStorage unavailable
2626
}
2727

28-
// First-time visitor: record the version silently, nothing to announce.
29-
if (storedVersion === null) {
30-
try {
31-
localStorage.setItem(STORAGE_KEY, latest.version);
32-
} catch {
33-
// ignore
34-
}
35-
return;
36-
}
28+
const isOutdated =
29+
storedVersion === null ||
30+
storedVersion.localeCompare(latest.version, undefined, {
31+
numeric: true,
32+
}) < 0;
3733

38-
// Already seen this version.
39-
if (storedVersion === latest.version) return;
34+
// TODO(v0.4): revert to the standard "null = first-time visitor, record silently"
35+
// path. The null case intentionally shows the card for this release so existing
36+
// users who never had the key get the 0.3.0 announcement.
37+
if (!isOutdated) return;
4038

41-
// New version since last visit: record it and show the notification.
4239
try {
4340
localStorage.setItem(STORAGE_KEY, latest.version);
4441
} catch {

0 commit comments

Comments
 (0)