From 90f4dcb10caeace103546c48f82f60ef6b407ef7 Mon Sep 17 00:00:00 2001 From: Carlos Gutierrez Date: Sun, 15 Mar 2026 10:05:56 -0400 Subject: [PATCH] fixing the size on reset --- frontend/src/components/organisms/QRForm.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/organisms/QRForm.tsx b/frontend/src/components/organisms/QRForm.tsx index 42be76f..40db553 100644 --- a/frontend/src/components/organisms/QRForm.tsx +++ b/frontend/src/components/organisms/QRForm.tsx @@ -10,8 +10,9 @@ const QRForm: React.FC = () => { const { state, dispatch } = useQrStore(); const { text, size, loading } = state; - const callingApi = async (overrideText?: string) => { + const callingApi = async (overrideText?: string, overrideSize?: number) => { const currentText = overrideText ?? text; + const currentSize = overrideSize ?? size; dispatch({ type: 'setError', payload: null }); dispatch({ type: 'setImageUrl', payload: null }); @@ -22,7 +23,7 @@ const QRForm: React.FC = () => { dispatch({ type: 'setLoading', payload: true }); try { - const payload = { text: currentText, size }; + const payload = { text: currentText, size: currentSize }; const res: GenerateResult = await generateQr(payload); const blobType = { type: res.mime }; const blob = new Blob([res.data], blobType); @@ -56,7 +57,7 @@ const QRForm: React.FC = () => { useEffect(() => { if (callApiOnReset) { - callingApi(initialState.text); + callingApi(initialState.text, initialState.size); setCallApiOnReset(false); } }, [callApiOnReset, callingApi]);