From 01e04c4c8deffb9ddbee0624bdae749dcfb695d2 Mon Sep 17 00:00:00 2001 From: Edgar Khanzadian Date: Thu, 16 Nov 2023 19:06:24 +0400 Subject: [PATCH] fix(ui): do not reset field on dropdown open --- .../hooks/use-recipient-select-fields.tsx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/app/pages/send/send-crypto-asset-form/components/recipient-fields/hooks/use-recipient-select-fields.tsx b/src/app/pages/send/send-crypto-asset-form/components/recipient-fields/hooks/use-recipient-select-fields.tsx index 4fe6ef180ac..730c2c58bb4 100644 --- a/src/app/pages/send/send-crypto-asset-form/components/recipient-fields/hooks/use-recipient-select-fields.tsx +++ b/src/app/pages/send/send-crypto-asset-form/components/recipient-fields/hooks/use-recipient-select-fields.tsx @@ -28,10 +28,10 @@ export function useRecipientSelectFields() { const resetAllRecipientFields = useCallback(() => { void setFieldValue('recipient', ''); setFieldError('recipient', undefined); - setFieldTouched('recipient', false); + void setFieldTouched('recipient', false); void setFieldValue('recipientBnsName', ''); setFieldError('recipientBnsName', undefined); - setFieldTouched('recipientBnsName', false); + void setFieldTouched('recipientBnsName', false); }, [setFieldError, setFieldTouched, setFieldValue]); const onSelectRecipientFieldType = useCallback( @@ -44,19 +44,11 @@ export function useRecipientSelectFields() { [resetAllRecipientFields, setBnsAddress] ); - const onSetIsSelectVisible = useCallback( - (value: boolean) => { - resetAllRecipientFields(); - setIsSelectVisible(value); - }, - [resetAllRecipientFields] - ); - return { isSelectVisible, onClickLabelAction, onSelectRecipientFieldType, - onSetIsSelectVisible, + onSetIsSelectVisible: setIsSelectVisible, selectedRecipientField, }; }