diff --git a/src/components/cart/CartDrawer.tsx b/src/components/cart/CartDrawer.tsx index 705b6f8..85cb1a3 100644 --- a/src/components/cart/CartDrawer.tsx +++ b/src/components/cart/CartDrawer.tsx @@ -30,16 +30,16 @@ export default function CartDrawer() { const lines = getLines(); const total = getTotal(); const lineCount = getLineCount(); - const [initialized, setInitialized] = useState(false); + const initializedRef = useRef(false); useEffect(() => { - if (!initialized && locale) { + if (!initializedRef.current && locale) { // Set language code before initializing checkout useSaleorCheckoutStore.getState().setLanguageCode(locale); initCheckout(); - setInitialized(true); + initializedRef.current = true; } - }, [initialized, locale]); + }, [locale]); useEffect(() => { if (isOpen) {