From cee7de0ac2ac977418065b20b192af19fbf5026e Mon Sep 17 00:00:00 2001 From: Paulo Ricardo Severo Date: Tue, 10 Dec 2024 09:19:21 -0300 Subject: [PATCH] fix: input location getting old country value. --- screens/generate-code-field/index.tsx | 2 +- screens/render-form-field/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/screens/generate-code-field/index.tsx b/screens/generate-code-field/index.tsx index fc51b0c..56bb808 100644 --- a/screens/generate-code-field/index.tsx +++ b/screens/generate-code-field/index.tsx @@ -229,7 +229,7 @@ export const generateCodeSnippet = (field: FormFieldType) => { }} onStateChange={(state) => { setStateName(state?.name || '') - form.setValue(field.name, [countryName || '', state?.name || '']) + form.setValue(field.name, [form.getValues(field.name)[0] || '', state?.name || '']) }} /> diff --git a/screens/render-form-field/index.tsx b/screens/render-form-field/index.tsx index 9d8f62d..5443ace 100644 --- a/screens/render-form-field/index.tsx +++ b/screens/render-form-field/index.tsx @@ -367,7 +367,7 @@ export const renderFormField = (field: FormFieldType, form: any) => { }} onStateChange={(state) => { setStateName(state?.name || '') - form.setValue(field.name, [countryName || '', state?.name || '']) + form.setValue(field.name, [form.getValues(field.name)[0] || '', state?.name || '']) }} /> {field.description}