From 3584c8a031b7c68fc5e09cf3e58d4361a80ba979 Mon Sep 17 00:00:00 2001 From: jinoosss Date: Wed, 13 Mar 2024 18:45:02 +0900 Subject: [PATCH] fix: [ADN-488] Fix disabled button bug when pasting 24-word mnemonic into the 12-word field --- .../components/molecules/web-seed-input/index.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/adena-extension/src/components/molecules/web-seed-input/index.tsx b/packages/adena-extension/src/components/molecules/web-seed-input/index.tsx index 1f9fca733..ca8838657 100644 --- a/packages/adena-extension/src/components/molecules/web-seed-input/index.tsx +++ b/packages/adena-extension/src/components/molecules/web-seed-input/index.tsx @@ -78,6 +78,15 @@ export const WebSeedInput = ({ errorMessage, onChange }: WebSeedInputProps): Rea [type, wordList], ); + const onChangeWebSeedInputByWords = useCallback( + (value: string) => { + const words = _getFilledWordList(type, value.split(' ')); + setWordList(words); + onChange({ type, value: words.join(' ') }); + }, + [type], + ); + const TypeMenuItem = useCallback( ({ title, _type }: { title: string; _type: WebSeedInputType }): ReactElement => { const selected = type === _type; @@ -130,8 +139,7 @@ export const WebSeedInput = ({ errorMessage, onChange }: WebSeedInputProps): Rea error={!!errorMessage} onChange={(value: string): void => { if (index === 0 && value.split(' ').length > 1) { - setWordList(value.split(' ')); - onChange({ type, value }); + onChangeWebSeedInputByWords(value); } else { onChangeWord(index, value); }