Fix cost not set after form reset
This commit is contained in:
		
							parent
							
								
									5b821906cf
								
							
						
					
					
						commit
						4d725272e3
					
				@ -82,8 +82,8 @@ export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton,
 | 
				
			|||||||
  const cost = baseFee * (hasImgLink ? 10 : 1) * Math.pow(10, repetition) + Number(boost)
 | 
					  const cost = baseFee * (hasImgLink ? 10 : 1) * Math.pow(10, repetition) + Number(boost)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    formik.setFieldValue('cost', cost)
 | 
					    formik?.setFieldValue('cost', cost)
 | 
				
			||||||
  }, [cost])
 | 
					  }, [formik?.getFieldProps('cost').value, cost])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const show = alwaysShow || !formik?.isSubmitting
 | 
					  const show = alwaysShow || !formik?.isSubmitting
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
@ -142,8 +142,8 @@ export function EditFeeButton ({ paidSats, hadImgLink, hasImgLink, ChildButton,
 | 
				
			|||||||
  const cost = (addImgLink ? paidSats * 9 : 0) + Number(boost)
 | 
					  const cost = (addImgLink ? paidSats * 9 : 0) + Number(boost)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    formik.setFieldValue('cost', cost)
 | 
					    formik?.setFieldValue('cost', cost)
 | 
				
			||||||
  }, [cost])
 | 
					  }, [formik?.getFieldProps('cost').value, cost])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const show = alwaysShow || !formik?.isSubmitting
 | 
					  const show = alwaysShow || !formik?.isSubmitting
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user