@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/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +8 -2
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +8 -2
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3599,6 +3599,9 @@ function CartProvider({
|
|
|
3599
3599
|
const filteredSameCommonAttributes = commonAttributes.filter(
|
|
3600
3600
|
(attr) => !customAttributes.some((a) => a.key === attr.key)
|
|
3601
3601
|
);
|
|
3602
|
+
const attributesNeedRemove = customAttributesNeedRemove.filter(
|
|
3603
|
+
((attribute) => !customAttributes.find((a) => a.key === attribute.key))
|
|
3604
|
+
);
|
|
3602
3605
|
const newAttributes = [
|
|
3603
3606
|
...filteredSameCommonAttributes,
|
|
3604
3607
|
...customAttributes
|
|
@@ -3606,10 +3609,13 @@ function CartProvider({
|
|
|
3606
3609
|
const needUpdate = cart && checkAttributesUpdateNeeded(
|
|
3607
3610
|
cart.customAttributes,
|
|
3608
3611
|
newAttributes,
|
|
3609
|
-
|
|
3612
|
+
attributesNeedRemove
|
|
3613
|
+
);
|
|
3614
|
+
const finalAttributes = newAttributes.filter(
|
|
3615
|
+
(attribute) => !attributesNeedRemove.find((a) => a.key === attribute.key)
|
|
3610
3616
|
);
|
|
3611
3617
|
if (needUpdate) {
|
|
3612
|
-
return updateAttributes({ attributes:
|
|
3618
|
+
return updateAttributes({ attributes: finalAttributes });
|
|
3613
3619
|
} else {
|
|
3614
3620
|
return Promise.resolve(cart);
|
|
3615
3621
|
}
|