@graphcommerce/magento-cart-items 9.0.0-canary.79 → 9.0.0-canary.80
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-canary.80
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2341](https://github.com/graphcommerce-org/graphcommerce/pull/2341) [`1d6512d`](https://github.com/graphcommerce-org/graphcommerce/commit/1d6512d4118cfb46602aa1f2432c3566fdb3261d) - Rename experimental_useV2 prop to deprecated_useV1 in useFromGql and enable it by default ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#2341](https://github.com/graphcommerce-org/graphcommerce/pull/2341) [`97522bd`](https://github.com/graphcommerce-org/graphcommerce/commit/97522bdb2505e6b57de98ea02ca252341ac69443) - Solve issue where the CartEditForm would temporarily show an empty cart after saving. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
|
|
12
|
+
|
|
3
13
|
## 9.0.0-canary.79
|
|
4
14
|
|
|
5
15
|
## 9.0.0-canary.78
|
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
AddToCartItemSelector,
|
|
6
6
|
AddProductsToCartForm,
|
|
7
7
|
} from '@graphcommerce/magento-product'
|
|
8
|
-
import {
|
|
8
|
+
import { useRouter } from 'next/router'
|
|
9
|
+
import { useEffect, useRef } from 'react'
|
|
10
|
+
import { CartItemsFragment } from '../../../Api/CartItems.gql'
|
|
9
11
|
import {
|
|
10
12
|
UseRemoveItemFromCartProps,
|
|
11
13
|
useRemoveItemFromCart,
|
|
@@ -57,3 +59,12 @@ export function EditCartItemForm(props: EditCartItemFormProps) {
|
|
|
57
59
|
</AddProductsToCartForm>
|
|
58
60
|
)
|
|
59
61
|
}
|
|
62
|
+
|
|
63
|
+
export function useEditItem(cart: CartItemsFragment | null | undefined) {
|
|
64
|
+
const cartItemId = useRouter().query.cartItemId as string
|
|
65
|
+
const cartItem = cart?.items?.find((item) => item?.uid === cartItemId)
|
|
66
|
+
const cartItemRef = useRef(cartItem)
|
|
67
|
+
if (cartItem) cartItemRef.current = cartItem
|
|
68
|
+
|
|
69
|
+
return cartItemRef.current
|
|
70
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NumberFieldElement, NumberFieldElementProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { ApolloCartErrorSnackbar, useFormGqlMutationCart } from '@graphcommerce/magento-cart'
|
|
3
|
-
import { TextInputNumberProps } from '@graphcommerce/next-ui'
|
|
4
3
|
import { FormAutoSubmit, UseFormGraphQlOptions } from '@graphcommerce/react-hook-form'
|
|
5
4
|
import { SxProps, Theme } from '@mui/material'
|
|
6
5
|
import React from 'react'
|
|
@@ -27,7 +26,6 @@ export type UpdateItemQuantityProps = Omit<UpdateItemQuantityMutationVariables,
|
|
|
27
26
|
export function UpdateItemQuantity(props: UpdateItemQuantityProps) {
|
|
28
27
|
const { uid, quantity, sx, textInputProps, formOptions } = props
|
|
29
28
|
const form = useFormGqlMutationCart(UpdateItemQuantityDocument, {
|
|
30
|
-
experimental_useV2: true,
|
|
31
29
|
defaultValues: { uid, quantity },
|
|
32
30
|
mode: 'onChange',
|
|
33
31
|
...formOptions,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-cart-items",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.80",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
16
|
-
"@graphcommerce/framer-next-pages": "^9.0.0-canary.
|
|
17
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
|
18
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/magento-cart": "^9.0.0-canary.
|
|
20
|
-
"@graphcommerce/magento-customer": "^9.0.0-canary.
|
|
21
|
-
"@graphcommerce/magento-product": "^9.0.0-canary.
|
|
22
|
-
"@graphcommerce/magento-store": "^9.0.0-canary.
|
|
23
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
|
24
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
25
|
-
"@graphcommerce/react-hook-form": "^9.0.0-canary.
|
|
26
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.80",
|
|
16
|
+
"@graphcommerce/framer-next-pages": "^9.0.0-canary.80",
|
|
17
|
+
"@graphcommerce/graphql": "^9.0.0-canary.80",
|
|
18
|
+
"@graphcommerce/image": "^9.0.0-canary.80",
|
|
19
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.80",
|
|
20
|
+
"@graphcommerce/magento-customer": "^9.0.0-canary.80",
|
|
21
|
+
"@graphcommerce/magento-product": "^9.0.0-canary.80",
|
|
22
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.80",
|
|
23
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.80",
|
|
24
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.80",
|
|
25
|
+
"@graphcommerce/react-hook-form": "^9.0.0-canary.80",
|
|
26
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.80",
|
|
27
27
|
"@lingui/core": "^4.2.1",
|
|
28
28
|
"@lingui/macro": "^4.2.1",
|
|
29
29
|
"@lingui/react": "^4.2.1",
|