@faststore/api 1.12.7 → 1.12.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.esm.js CHANGED
@@ -1687,6 +1687,18 @@ const Query = {
1687
1687
  }
1688
1688
 
1689
1689
  const sku = await skuLoader.load(skuId);
1690
+ /**
1691
+ * Here be dragons 🦄🦄🦄
1692
+ *
1693
+ * In some cases, the slug has a valid skuId for a different
1694
+ * product. This condition makes sure that the fetched sku
1695
+ * is the one we actually asked for
1696
+ * */
1697
+
1698
+ if (slug && sku.isVariantOf.linkText && !slug.startsWith(sku.isVariantOf.linkText)) {
1699
+ throw new Error(`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${slug}, linkText: ${sku.isVariantOf.linkText}`);
1700
+ }
1701
+
1690
1702
  return sku;
1691
1703
  } catch (err) {
1692
1704
  if (slug == null) {