ChemPal Documentation - v1.6.0
    Preparing search index...

    Function getStoredAppVersion

    • Read the app version that last wrote or migrated the cache, from the single app_meta row keyed "current". Returns undefined on a fresh install (the row has never been written) or when the read fails — callers treat undefined as "no marker yet" and seed the current version instead of migrating.

      Returns Promise<undefined | string>

      The stored semver string (e.g. "1.0.0"), or undefined when unset.

      const from = await getStoredAppVersion(); // => "1.0.0" | undefined
      
      export async function getStoredAppVersion(): Promise<string | undefined> {
      try {
      const db = await getDB();
      const record = await db.get(IDB_STORE.APP_META, APP_META_KEY);
      return record?.appVersion;
      } catch (error) {
      logger.error('Failed to get stored app version from IndexedDB', { error });
      return undefined;
      }
      }