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

    Function setStoredAppVersion

    • Record the app version that now owns the cache, overwriting the single app_meta row. Called after migrations complete, after a fresh-install seed, and after a Cancel/reset, so the stored marker always reflects the version whose data shape is currently in IndexedDB.

      Parameters

      • appVersion: string

        The semver string to persist (typically __APP_VERSION__).

      Returns Promise<void>

      Resolves once the write completes; errors are logged, not thrown.

      await setStoredAppVersion("1.1.0");
      await getStoredAppVersion(); // => "1.1.0"
      export async function setStoredAppVersion(appVersion: string): Promise<void> {
      try {
      const db = await getDB();
      await db.put(IDB_STORE.APP_META, {
      id: APP_META_KEY,
      appVersion,
      updatedAt: Date.now(),
      });
      } catch (error) {
      logger.error('Failed to set stored app version in IndexedDB', { error });
      }
      }