Skip to content

Commit

Permalink
Fix delivery method glitch-reset
Browse files Browse the repository at this point in the history
  • Loading branch information
dgopsq committed Sep 8, 2023
1 parent 0b094de commit 2233dce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/checkout/CheckoutDeliveryMethods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const CheckoutDeliveryMethod: React.FC<Props> = ({
const deliveryMethodsRender = useMemo(
() =>
deliveryMethods.map((deliveryMethod) => {
const isSameAddr = deliveryMethod.id === value?.id;
const isSameMethod = deliveryMethod.id === value?.id;

const handleClick = () => {
if (!isLoading) onChange?.(deliveryMethod);
Expand All @@ -35,7 +35,7 @@ export const CheckoutDeliveryMethod: React.FC<Props> = ({
type="button"
className="w-full h-full"
>
<RadioIsland isSelected={isSameAddr}>
<RadioIsland isSelected={isSameMethod}>
<SingleDeliveryMethod deliveryMethod={deliveryMethod} />
</RadioIsland>
</button>
Expand Down
1 change: 1 addition & 0 deletions src/misc/hooks/useCheckoutInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function useCheckoutInfo(): UseCheckoutInfoReturn {
// FIXME: This could be buggy or prone to create errors.
useEffect(() => {
if (!complete) return;
if (data.deliveryMethod) return;

const parsedMethods = data.shippingMethods.map((method) => {
return getFragmentData(GenericShippingMethodFragmentDoc, method);
Expand Down

0 comments on commit 2233dce

Please sign in to comment.