MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / showNewVersionNotification

Function showNewVersionNotification

src/store/migration.ts:209–232  ·  view source on GitHub ↗

* 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.

()

Source from the content-addressed store, hash-verified

207 * Caches the current app version in localStorage so we can detect upgrades.
208 */
209function 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
234export function initStoreMigration(): boolean {
235 const migratedLegacyStore = migrateFromLegacyStore();

Callers 1

initStoreMigrationFunction · 0.85

Calls 2

getItemMethod · 0.80
setItemMethod · 0.80

Tested by

no test coverage detected