ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function removeExcludedProduct

    • Remove a single entry from the excluded-products map in IndexedDB. Load → delete → put, matching addExcludedProduct's read-modify-write shape so a caller holding a stale map cannot clobber concurrent writes. No-op (and no write) when the key is absent, so repeated removals are safe. Errors are logged, not thrown — callers don't need to try/catch.

      Parameters

      • key: string

        Exclusion key, as produced by getProductExclusionKey.

      Returns Promise<void>

      Resolves once the write completes.

      const key = getProductExclusionKey(product.url, product.supplier);
      await removeExcludedProduct(key);
      // entry for `key` is gone from IndexedDB; next search may surface the
      // product again (subject to any cached supplier results).
      export async function removeExcludedProduct(key: string): Promise<void> {
      try {
      const map = await loadExcludedProducts();
      if (map[key] === undefined) return;
      delete map[key];
      await putExcludedProducts(map);
      } catch (error) {
      console.warn("Failed to remove excluded product from IndexedDB:", { error });
      }
      }