From a0054a6432359f7b78dc8fba081c35394a53c6fa Mon Sep 17 00:00:00 2001 From: Florian de Vries Date: Fri, 20 Sep 2024 15:30:36 +0200 Subject: [PATCH] fix(checkout): use most recently selected shipping price --- .../listeners/updateCheckoutOnUpdate.ts | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/views/js/frontend/checkout/src/deliveryOptions/listeners/updateCheckoutOnUpdate.ts b/views/js/frontend/checkout/src/deliveryOptions/listeners/updateCheckoutOnUpdate.ts index 16101c4c..4b14dc81 100644 --- a/views/js/frontend/checkout/src/deliveryOptions/listeners/updateCheckoutOnUpdate.ts +++ b/views/js/frontend/checkout/src/deliveryOptions/listeners/updateCheckoutOnUpdate.ts @@ -1,14 +1,14 @@ -import {debounce, type DeliveryOptionsStoreState, type StoreCallbackUpdate} from '@myparcel-pdk/checkout'; +import { + debounce, + useDeliveryOptionsStore, + type DeliveryOptionsStoreState, + type StoreCallbackUpdate, +} from '@myparcel-pdk/checkout'; import {objectIsEqual} from '@myparcel/ts-utils'; import {getCurrentShippingMethod} from '../../utils'; const CHECKOUT_UPDATE_DELAY = 200; -/** - * Only do this once to avoid excessive animations. - */ -let done = false; - export const onDeliveryOptionsOutputChange: StoreCallbackUpdate = debounce( (newState, oldState) => { if (objectIsEqual(newState.output, oldState?.output)) { @@ -21,13 +21,12 @@ export const onDeliveryOptionsOutputChange: StoreCallbackUpdate