@anker-in/shopify-react 1.2.1 → 1.2.2-beta.2

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/index.mjs CHANGED
@@ -3591,6 +3591,9 @@ function CartProvider({
3591
3591
  const filteredSameCommonAttributes = commonAttributes.filter(
3592
3592
  (attr) => !customAttributes.some((a) => a.key === attr.key)
3593
3593
  );
3594
+ const attributesNeedRemove = customAttributesNeedRemove.filter(
3595
+ ((attribute) => !customAttributes.find((a) => a.key === attribute.key))
3596
+ );
3594
3597
  const newAttributes = [
3595
3598
  ...filteredSameCommonAttributes,
3596
3599
  ...customAttributes
@@ -3598,10 +3601,13 @@ function CartProvider({
3598
3601
  const needUpdate = cart && checkAttributesUpdateNeeded(
3599
3602
  cart.customAttributes,
3600
3603
  newAttributes,
3601
- customAttributesNeedRemove
3604
+ attributesNeedRemove
3605
+ );
3606
+ const finalAttributes = newAttributes.filter(
3607
+ (attribute) => !attributesNeedRemove.find((a) => a.key === attribute.key)
3602
3608
  );
3603
3609
  if (needUpdate) {
3604
- return updateAttributes({ attributes: newAttributes });
3610
+ return updateAttributes({ attributes: finalAttributes });
3605
3611
  } else {
3606
3612
  return Promise.resolve(cart);
3607
3613
  }