From 4aa8e8c3c60cdb358b355ce352655951e6a147ee Mon Sep 17 00:00:00 2001 From: Phoebe Lartisant Date: Mon, 20 May 2024 18:03:05 +0200 Subject: [PATCH] fix lint errors + new set error --- .../src/pages/TransferCoins/SendCoins/SendForm.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web-frontend/src/pages/TransferCoins/SendCoins/SendForm.tsx b/web-frontend/src/pages/TransferCoins/SendCoins/SendForm.tsx index beac04c0..ded16d33 100644 --- a/web-frontend/src/pages/TransferCoins/SendCoins/SendForm.tsx +++ b/web-frontend/src/pages/TransferCoins/SendCoins/SendForm.tsx @@ -94,9 +94,8 @@ export function SendForm(props: SendFormProps) { setFees(sendOpData.fees); setSelectedAsset(sendOpData.asset); } - }, [sendOpData, redirectAmount, redirectedTo]); + }, [sendOpData, redirectAmount, redirectedTo, resolveDns]); - const mnsExtensionRegex = /\.massa$/; const mnsExtension = '.massa'; function validate(formObject: IForm) { @@ -146,7 +145,7 @@ export function SendForm(props: SendFormProps) { e.preventDefault(); let formObject = parseForm(e); - if (targetMnsAddress && mnsExtensionRegex.test(recipient)) { + if (targetMnsAddress && /\.massa$/.test(recipient)) { // recipient is a domain name formObject = { ...formObject, @@ -181,9 +180,10 @@ export function SendForm(props: SendFormProps) { const handleRecipientChange = useCallback( async (e: ChangeEvent) => { + const mnsExtensionRegex = /\.massa$/; const value = e.target.value; setRecipient(value); - setError({ recipient: '', amount: error?.amount }); + setError((error) => ({ ...error, recipient: '' })); if (value !== '' && mnsExtensionRegex.test(value)) { const inputMns = value.replace(mnsExtension, ''); const targetAddress = await resolveDns(inputMns); @@ -195,7 +195,7 @@ export function SendForm(props: SendFormProps) { } } }, - [recipient, resolveDns, resetTargetMnsAddress, mnsExtensionRegex], + [resolveDns, resetTargetMnsAddress], ); return (