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

    Function getExcludedProducts

    • Load the user's excluded-products map from the excludedProducts object store. The whole map lives under a single row keyed by "current" (same single-row pattern used by searchResults), so this is a single read. Returns {} when the store is empty or the read fails, letting callers treat the result as always-valid without null-checking.

      Returns Promise<ExcludedProductsMap>

      Map of md5 exclusion key → entry, or {} when absent.

      const excluded = await getExcludedProducts();
      // => { "a1b2c3…": { url: "https://…", supplier: "Loudwolf",
      // title: "Acetone 500ml", excludedAt: 1713301200000 } }
      if (excluded[key]) {
      // product is on the ignore list
      }
      export async function getExcludedProducts(): Promise<ExcludedProductsMap> {
      try {
      const db = await getDB();
      const record = await db.get(IDB_STORE.EXCLUDED_PRODUCTS, 'current');
      return record?.map ?? {};
      } catch (error) {
      logger.error('Failed to get excluded products from IndexedDB', { error });
      return {};
      }
      }