diff --git a/package-lock.json b/package-lock.json index 568f7bfe55..ae6a94764d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32009,7 +32009,7 @@ }, "packages/cli": { "name": "@shopify/cli-hydrogen", - "version": "11.1.6", + "version": "11.1.7", "license": "MIT", "dependencies": { "@ast-grep/napi": "0.34.1", @@ -32393,7 +32393,7 @@ }, "packages/create-hydrogen": { "name": "@shopify/create-hydrogen", - "version": "5.0.26", + "version": "5.0.27", "license": "MIT", "dependencies": { "@ast-grep/napi": "0.34.1" @@ -32968,11 +32968,11 @@ }, "packages/hydrogen": { "name": "@shopify/hydrogen", - "version": "2025.7.2", + "version": "2025.7.3", "license": "MIT", "dependencies": { "@shopify/graphql-client": "1.4.1", - "@shopify/hydrogen-react": "2025.7.1", + "@shopify/hydrogen-react": "2025.7.2", "content-security-policy-builder": "^2.2.0", "flame-chart-js": "2.3.1", "isbot": "^5.1.21", @@ -33537,7 +33537,7 @@ }, "packages/hydrogen-react": { "name": "@shopify/hydrogen-react", - "version": "2025.7.1", + "version": "2025.7.2", "license": "MIT", "dependencies": { "@google/model-viewer": "^4.0.0", @@ -35374,9 +35374,9 @@ } }, "templates/skeleton": { - "version": "2025.7.2", + "version": "2025.7.3", "dependencies": { - "@shopify/hydrogen": "2025.7.2", + "@shopify/hydrogen": "2025.7.3", "graphql": "^16.10.0", "graphql-tag": "^2.12.6", "isbot": "^5.1.22", diff --git a/templates/skeleton/app/components/CartSummary.tsx b/templates/skeleton/app/components/CartSummary.tsx index cd0dad0eff..1f5eeca95c 100644 --- a/templates/skeleton/app/components/CartSummary.tsx +++ b/templates/skeleton/app/components/CartSummary.tsx @@ -3,7 +3,6 @@ import type {CartLayout} from '~/components/CartMain'; import {CartForm, Money, type OptimisticCart} from '@shopify/hydrogen'; import {useEffect, useRef} from 'react'; import {useFetcher} from 'react-router'; -import type {FetcherWithComponents} from 'react-router'; type CartSummaryProps = { cart: OptimisticCart; @@ -122,27 +121,17 @@ function CartGiftCard({ }: { giftCardCodes: CartApiQueryFragment['appliedGiftCards'] | undefined; }) { - const appliedGiftCardCodes = useRef([]); const giftCardCodeInput = useRef(null); const giftCardAddFetcher = useFetcher({key: 'gift-card-add'}); - // Clear the gift card code input after the gift card is added useEffect(() => { if (giftCardAddFetcher.data) { giftCardCodeInput.current!.value = ''; } }, [giftCardAddFetcher.data]); - function saveAppliedCode(code: string) { - const formattedCode = code.replace(/\s/g, ''); // Remove spaces - if (!appliedGiftCardCodes.current.includes(formattedCode)) { - appliedGiftCardCodes.current.push(formattedCode); - } - } - return (
- {/* Display applied gift cards with individual remove buttons */} {giftCardCodes && giftCardCodes.length > 0 && (
Applied Gift Card(s)
@@ -160,11 +149,7 @@ function CartGiftCard({
)} - {/* Show an input to apply a gift card */} - +
void; fetcherKey?: string; children: React.ReactNode; }) { @@ -197,13 +180,7 @@ function AddGiftCardForm({ route="/cart" action={CartForm.ACTIONS.GiftCardCodesAdd} > - {(fetcher: FetcherWithComponents) => { - const code = fetcher.formData?.get('giftCardCode'); - if (code && saveAppliedCode) { - saveAppliedCode(code as string); - } - return children; - }} + {children} ); }