* Check if the app version changed since last visit and show a notification if so. * Caches the current app version in localStorage so we can detect upgrades.
()
| 207 | * Caches the current app version in localStorage so we can detect upgrades. |
| 208 | */ |
| 209 | function showNewVersionNotification(): void { |
| 210 | if (typeof window === 'undefined') return; |
| 211 | |
| 212 | const currentVersion = typeof __APP_VERSION__ === 'string' ? __APP_VERSION__ : ''; |
| 213 | if (!currentVersion) return; |
| 214 | |
| 215 | const lastSeenVersion = localStorage.getItem(STORAGE_KEYS.lastSeenVersion); |
| 216 | |
| 217 | // First visit ever — just record the version, no notification |
| 218 | if (lastSeenVersion === null) { |
| 219 | localStorage.setItem(STORAGE_KEYS.lastSeenVersion, currentVersion); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | // Same version — nothing to do |
| 224 | if (lastSeenVersion === currentVersion) return; |
| 225 | |
| 226 | // Version changed — show notification and update cached version |
| 227 | useNotificationStore.getState().addNotification( |
| 228 | 'info', |
| 229 | `Updated to v${currentVersion}! Consider resetting settings via the ⟳ button in Settings to enable new defaults.` |
| 230 | ); |
| 231 | localStorage.setItem(STORAGE_KEYS.lastSeenVersion, currentVersion); |
| 232 | } |
| 233 | |
| 234 | export function initStoreMigration(): boolean { |
| 235 | const migratedLegacyStore = migrateFromLegacyStore(); |
no test coverage detected