From 4d725272e3898d967b5111b8d9a65fefdc269f00 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 12 Aug 2023 02:40:37 +0200 Subject: [PATCH] Fix cost not set after form reset --- components/fee-button.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/fee-button.js b/components/fee-button.js index 3ff672d9..96f28473 100644 --- a/components/fee-button.js +++ b/components/fee-button.js @@ -82,8 +82,8 @@ export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton, const cost = baseFee * (hasImgLink ? 10 : 1) * Math.pow(10, repetition) + Number(boost) useEffect(() => { - formik.setFieldValue('cost', cost) - }, [cost]) + formik?.setFieldValue('cost', cost) + }, [formik?.getFieldProps('cost').value, cost]) const show = alwaysShow || !formik?.isSubmitting return ( @@ -142,8 +142,8 @@ export function EditFeeButton ({ paidSats, hadImgLink, hasImgLink, ChildButton, const cost = (addImgLink ? paidSats * 9 : 0) + Number(boost) useEffect(() => { - formik.setFieldValue('cost', cost) - }, [cost]) + formik?.setFieldValue('cost', cost) + }, [formik?.getFieldProps('cost').value, cost]) const show = alwaysShow || !formik?.isSubmitting return (