From b13699f9558985b371fb53533a0927234711fa60 Mon Sep 17 00:00:00 2001 From: parsaaghayi Date: Sat, 22 Aug 2026 19:30:05 +0330 Subject: [PATCH] fix(checkout): fix conditional react hook calls in CheckoutPage --- frontend/application/components/CheckoutPage.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/application/components/CheckoutPage.tsx b/frontend/application/components/CheckoutPage.tsx index a371cc6a..5ce6ae94 100644 --- a/frontend/application/components/CheckoutPage.tsx +++ b/frontend/application/components/CheckoutPage.tsx @@ -41,6 +41,9 @@ export default function CheckoutPage() { const [showTopUpModal, setShowTopUpModal] = useState(false); const [showAddressModal, setShowAddressModal] = useState(false); + const isRefillEnabled = useSettingsStore((state) => state.getText('REFILL_SUBSCRIPTION_ENABLED', 'false') === 'true'); + const refillPercent = Number(useSettingsStore((state) => state.getText('REFILL_REWARD_PERCENT', '5'))) || 5; + const [selectedPetId, setSelectedPetId] = useState(activePetId || (pets[0]?.id ?? null)); const [selectedAddressId, setSelectedAddressId] = useState(''); @@ -255,11 +258,6 @@ export default function CheckoutPage() { ); - } - - const isRefillEnabled = useSettingsStore((state) => state.getText('REFILL_SUBSCRIPTION_ENABLED', 'false') === 'true'); - const refillPercent = Number(useSettingsStore((state) => state.getText('REFILL_REWARD_PERCENT', '5'))) || 5; - return (