Describe the Bug
The CouponAccordion uses a query: GetCouponDocument. This imports (node_modules/@graphcommerce/magento-cart-coupon/CouponAccordion/GetCoupon.graphql):
query GetCoupon($cartId: String!) {
cart(cart_id: $cartId) {
...Coupon
}
}
Which imports (node_modules/@graphcommerce/magento-cart-coupon/Api/Coupon.graphql):
fragment Coupon on Cart @injectable {
id
__typename
applied_coupons {
code
}
}
Problem
Because Coupon is a cart fragment, it imports more than needed. It also causes the Coupon component to update anytime the cart updates.
Recommendation
Add the Coupon's fragment directly to the GetCoupon for a leaner request and less frequent Coupon component updates.
Expected Behavior
Coupon query does not get shipping addresses and cart prices.
To Reproduce
- Navigation to the cart
- Make a change to the cart
- Notice that the Coupon query is called.
Describe the Bug
The
CouponAccordionuses a query:GetCouponDocument. This imports (node_modules/@graphcommerce/magento-cart-coupon/CouponAccordion/GetCoupon.graphql):Which imports (
node_modules/@graphcommerce/magento-cart-coupon/Api/Coupon.graphql):Problem
Because
Couponis a cart fragment, it imports more than needed. It also causes the Coupon component to update anytime the cart updates.Recommendation
Add the Coupon's fragment directly to the
GetCouponfor a leaner request and less frequent Coupon component updates.Expected Behavior
Coupon query does not get shipping addresses and cart prices.
To Reproduce