@anker-in/shopify-react 1.2.0-beta.4 → 1.2.0-beta.5
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.d.mts +3 -1
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.js +4 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -3
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +3 -1
- package/dist/provider/index.d.ts +3 -1
- package/dist/provider/index.js +8 -5
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +8 -5
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +17 -17
package/dist/provider/index.mjs
CHANGED
|
@@ -963,7 +963,8 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
963
963
|
mutateCart,
|
|
964
964
|
isCartLoading,
|
|
965
965
|
setLoadingState,
|
|
966
|
-
metafieldIdentifiers
|
|
966
|
+
metafieldIdentifiers,
|
|
967
|
+
disabled = false
|
|
967
968
|
}) => {
|
|
968
969
|
const { client, cartCookieAdapter } = useShopify();
|
|
969
970
|
const mainProductDiscountCodes = useMemo(
|
|
@@ -1041,7 +1042,7 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
1041
1042
|
);
|
|
1042
1043
|
const { loading } = useRequest(
|
|
1043
1044
|
async () => {
|
|
1044
|
-
if (linesNeedUpdate?.length && !isCartLoading) {
|
|
1045
|
+
if (linesNeedUpdate?.length && !isCartLoading && !disabled) {
|
|
1045
1046
|
const result = await updateCartLines(client, {
|
|
1046
1047
|
cartId: cart?.id || "",
|
|
1047
1048
|
lines: linesNeedUpdate,
|
|
@@ -1057,7 +1058,7 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
1057
1058
|
throttleWait: 3e3,
|
|
1058
1059
|
// 3 秒内只触发最后一次更新
|
|
1059
1060
|
throttleTrailing: true,
|
|
1060
|
-
refreshDeps: [linesNeedUpdate, isCartLoading]
|
|
1061
|
+
refreshDeps: [linesNeedUpdate, isCartLoading, disabled]
|
|
1061
1062
|
}
|
|
1062
1063
|
);
|
|
1063
1064
|
useEffect(() => {
|
|
@@ -1176,7 +1177,8 @@ function CartProvider({
|
|
|
1176
1177
|
locale,
|
|
1177
1178
|
metafieldIdentifiers,
|
|
1178
1179
|
memberSetting,
|
|
1179
|
-
appContext
|
|
1180
|
+
appContext,
|
|
1181
|
+
disableUpdateLineCodeAmountAttributes = false
|
|
1180
1182
|
}) {
|
|
1181
1183
|
const { client, cartCookieAdapter } = useShopify();
|
|
1182
1184
|
const [customAttributes, setCustomAttributes] = useState([]);
|
|
@@ -1257,7 +1259,8 @@ function CartProvider({
|
|
|
1257
1259
|
mutateCart,
|
|
1258
1260
|
isCartLoading: isCartLoading || isCodeChanging,
|
|
1259
1261
|
setLoadingState,
|
|
1260
|
-
metafieldIdentifiers
|
|
1262
|
+
metafieldIdentifiers,
|
|
1263
|
+
disabled: disableUpdateLineCodeAmountAttributes
|
|
1261
1264
|
});
|
|
1262
1265
|
const removeCustomAttributes = useCallback(
|
|
1263
1266
|
(attributes) => {
|