From 5007b796cd4501e4e38f44cfd45a5318c2febf72 Mon Sep 17 00:00:00 2001 From: neven-s Date: Fri, 18 Nov 2022 15:18:59 -0500 Subject: [PATCH] CP-4074 Fix infinite render loop (#480) --- app/screens/onboarding/useCheckMnemonic.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/screens/onboarding/useCheckMnemonic.ts b/app/screens/onboarding/useCheckMnemonic.ts index 684bb5b02a..18c8f655bb 100644 --- a/app/screens/onboarding/useCheckMnemonic.ts +++ b/app/screens/onboarding/useCheckMnemonic.ts @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' type WordSelection = { index: number @@ -13,7 +13,7 @@ export type UseCheckMnemonicData = { } export function useCheckMnemonic(mnemonic: string): UseCheckMnemonicData { - const mnemonics = mnemonic.split(' ') + const mnemonics = useMemo(() => mnemonic.split(' '), [mnemonic]) const [firstWordSelection, setFirstWordSelection] = useState({ index: 0, wordOptions: []