From d90a44bb86088efd05bb85d994b3e7b617b73ead Mon Sep 17 00:00:00 2001 From: S2kael Date: Fri, 20 Oct 2023 12:14:25 +0700 Subject: [PATCH] [Issue-2040] Update list account can migrate --- .../src/Popup/Keyring/ApplyMasterPassword/index.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/extension-koni-ui/src/Popup/Keyring/ApplyMasterPassword/index.tsx b/packages/extension-koni-ui/src/Popup/Keyring/ApplyMasterPassword/index.tsx index a043b244f5..77cf741061 100644 --- a/packages/extension-koni-ui/src/Popup/Keyring/ApplyMasterPassword/index.tsx +++ b/packages/extension-koni-ui/src/Popup/Keyring/ApplyMasterPassword/index.tsx @@ -83,10 +83,14 @@ const intersectionArray = (array1: AccountJson[], array2: AccountJson[]): Accoun return array1.filter((account) => array2.find((acc) => acc.address === account.address)); }; -const filterAccountNeedMigrate = (acc: AccountJson) => { +const filterAccountMigrated = (acc: AccountJson) => { return acc.address !== ALL_ACCOUNT_KEY && !acc.isExternal && acc.isMasterPassword && !acc.isInjected; }; +const filterAccountCanMigrate = (acc: AccountJson) => { + return acc.address !== ALL_ACCOUNT_KEY && !acc.isExternal && !acc.isMasterPassword && !acc.isInjected; +}; + const Component: React.FC = (props: Props) => { const { isWebUI } = useContext(ScreenContext); const navigate = useNavigate(); @@ -109,11 +113,11 @@ const Component: React.FC = (props: Props) => { const checkUnlock = useUnlockChecker(); - const migratedRef = useRef(accounts.filter(filterAccountNeedMigrate)); + const migratedRef = useRef(accounts.filter(filterAccountMigrated)); const migrated = useMemo(() => { const oldVal = migratedRef.current; - const newVal = accounts.filter(filterAccountNeedMigrate); + const newVal = accounts.filter(filterAccountMigrated); const result = intersectionArray(oldVal, newVal); migratedRef.current = result; @@ -123,7 +127,7 @@ const Component: React.FC = (props: Props) => { const canMigrate = useMemo( () => accounts - .filter((acc) => acc.address !== ALL_ACCOUNT_KEY && !acc.isExternal) + .filter(filterAccountCanMigrate) .filter((acc) => !migrated.find((item) => item.address === acc.address)) , [accounts, migrated] );