@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/index.js CHANGED
@@ -1826,7 +1826,8 @@ var useUpdateLineCodeAmountAttributes = ({
1826
1826
  mutateCart,
1827
1827
  isCartLoading,
1828
1828
  setLoadingState,
1829
- metafieldIdentifiers
1829
+ metafieldIdentifiers,
1830
+ disabled = false
1830
1831
  }) => {
1831
1832
  const { client, cartCookieAdapter } = useShopify();
1832
1833
  const mainProductDiscountCodes = react.useMemo(
@@ -1904,7 +1905,7 @@ var useUpdateLineCodeAmountAttributes = ({
1904
1905
  );
1905
1906
  const { loading } = ahooks.useRequest(
1906
1907
  async () => {
1907
- if (linesNeedUpdate?.length && !isCartLoading) {
1908
+ if (linesNeedUpdate?.length && !isCartLoading && !disabled) {
1908
1909
  const result = await shopifySdk.updateCartLines(client, {
1909
1910
  cartId: cart?.id || "",
1910
1911
  lines: linesNeedUpdate,
@@ -1920,7 +1921,7 @@ var useUpdateLineCodeAmountAttributes = ({
1920
1921
  throttleWait: 3e3,
1921
1922
  // 3 秒内只触发最后一次更新
1922
1923
  throttleTrailing: true,
1923
- refreshDeps: [linesNeedUpdate, isCartLoading]
1924
+ refreshDeps: [linesNeedUpdate, isCartLoading, disabled]
1924
1925
  }
1925
1926
  );
1926
1927
  react.useEffect(() => {
@@ -3541,7 +3542,8 @@ function CartProvider({
3541
3542
  locale,
3542
3543
  metafieldIdentifiers,
3543
3544
  memberSetting,
3544
- appContext
3545
+ appContext,
3546
+ disableUpdateLineCodeAmountAttributes = false
3545
3547
  }) {
3546
3548
  const { client, cartCookieAdapter } = useShopify();
3547
3549
  const [customAttributes, setCustomAttributes] = react.useState([]);
@@ -3622,7 +3624,8 @@ function CartProvider({
3622
3624
  mutateCart,
3623
3625
  isCartLoading: isCartLoading || isCodeChanging,
3624
3626
  setLoadingState,
3625
- metafieldIdentifiers
3627
+ metafieldIdentifiers,
3628
+ disabled: disableUpdateLineCodeAmountAttributes
3626
3629
  });
3627
3630
  const removeCustomAttributes = react.useCallback(
3628
3631
  (attributes) => {