@anker-in/shopify-react 1.2.0-beta.4 → 1.2.0-beta.6

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
@@ -1818,7 +1818,8 @@ var useUpdateLineCodeAmountAttributes = ({
1818
1818
  mutateCart,
1819
1819
  isCartLoading,
1820
1820
  setLoadingState,
1821
- metafieldIdentifiers
1821
+ metafieldIdentifiers,
1822
+ disabled = false
1822
1823
  }) => {
1823
1824
  const { client, cartCookieAdapter } = useShopify();
1824
1825
  const mainProductDiscountCodes = useMemo(
@@ -1896,7 +1897,7 @@ var useUpdateLineCodeAmountAttributes = ({
1896
1897
  );
1897
1898
  const { loading } = useRequest(
1898
1899
  async () => {
1899
- if (linesNeedUpdate?.length && !isCartLoading) {
1900
+ if (linesNeedUpdate?.length && !isCartLoading && !disabled) {
1900
1901
  const result = await updateCartLines(client, {
1901
1902
  cartId: cart?.id || "",
1902
1903
  lines: linesNeedUpdate,
@@ -1912,7 +1913,7 @@ var useUpdateLineCodeAmountAttributes = ({
1912
1913
  throttleWait: 3e3,
1913
1914
  // 3 秒内只触发最后一次更新
1914
1915
  throttleTrailing: true,
1915
- refreshDeps: [linesNeedUpdate, isCartLoading]
1916
+ refreshDeps: [linesNeedUpdate, isCartLoading, disabled]
1916
1917
  }
1917
1918
  );
1918
1919
  useEffect(() => {
@@ -3533,7 +3534,8 @@ function CartProvider({
3533
3534
  locale,
3534
3535
  metafieldIdentifiers,
3535
3536
  memberSetting,
3536
- appContext
3537
+ appContext,
3538
+ disableUpdateLineCodeAmountAttributes = false
3537
3539
  }) {
3538
3540
  const { client, cartCookieAdapter } = useShopify();
3539
3541
  const [customAttributes, setCustomAttributes] = useState([]);
@@ -3614,7 +3616,8 @@ function CartProvider({
3614
3616
  mutateCart,
3615
3617
  isCartLoading: isCartLoading || isCodeChanging,
3616
3618
  setLoadingState,
3617
- metafieldIdentifiers
3619
+ metafieldIdentifiers,
3620
+ disabled: disableUpdateLineCodeAmountAttributes
3618
3621
  });
3619
3622
  const removeCustomAttributes = useCallback(
3620
3623
  (attributes) => {