diff --git a/packages/admin-next/dashboard/src/routes/campaigns/common/components/create-campaign-form-fields/create-campaign-form-fields.tsx b/packages/admin-next/dashboard/src/routes/campaigns/common/components/create-campaign-form-fields/create-campaign-form-fields.tsx index 1403aa55ad..6f0ce38cbc 100644 --- a/packages/admin-next/dashboard/src/routes/campaigns/common/components/create-campaign-form-fields/create-campaign-form-fields.tsx +++ b/packages/admin-next/dashboard/src/routes/campaigns/common/components/create-campaign-form-fields/create-campaign-form-fields.tsx @@ -37,16 +37,13 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => { name: `application_method.currency_code`, }) - const watchPromotionCurrencyCode = useWatch({ - control: form.control, - name: "application_method.currency_code", - }) + const currency = currencyValue || promotionCurrencyValue useEffect(() => { form.setValue(`${fieldScope}budget.limit`, null) - if (watchValueType === "spend") { - form.setValue(`campaign.budget.currency_code`, watchPromotionCurrencyCode) + if (isTypeSpend) { + form.setValue(`campaign.budget.currency_code`, promotionCurrencyValue) } if (watchValueType === "usage") { @@ -54,15 +51,15 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => { } }, [watchValueType]) - if (watchPromotionCurrencyCode) { + if (promotionCurrencyValue) { const formCampaignBudget = form.getValues().campaign?.budget const formCampaignCurrency = formCampaignBudget?.currency_code if ( formCampaignBudget?.type === "spend" && - formCampaignCurrency !== watchPromotionCurrencyCode + formCampaignCurrency !== promotionCurrencyValue ) { - form.setValue("campaign.budget.currency_code", watchPromotionCurrencyCode) + form.setValue("campaign.budget.currency_code", promotionCurrencyValue) } } @@ -195,9 +192,9 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => {