Unverified Commit 253c7fd3 authored by Hanwen Cheng's avatar Hanwen Cheng Committed by GitHub
Browse files

fix: navigation after path deletion (#514)

parent 962aa12b
Pipeline #73277 passed with stages
in 16 minutes and 32 seconds
...@@ -30,6 +30,7 @@ import { ...@@ -30,6 +30,7 @@ import {
getIdentityName, getIdentityName,
getNetworkKeyByPath, getNetworkKeyByPath,
getPathName, getPathName,
getPathsWithSubstrateNetwork,
isSubstratePath isSubstratePath
} from '../util/identitiesUtils'; } from '../util/identitiesUtils';
import { defaultNetworkKey, UnknownNetworkKeys } from '../constants'; import { defaultNetworkKey, UnknownNetworkKeys } from '../constants';
...@@ -61,8 +62,11 @@ export function PathDetailsView({ accounts, navigation, path, networkKey }) { ...@@ -61,8 +62,11 @@ export function PathDetailsView({ accounts, navigation, path, networkKey }) {
alertDeleteAccount('this key pairs', async () => { alertDeleteAccount('this key pairs', async () => {
await unlockSeedPhrase(navigation); await unlockSeedPhrase(navigation);
const deleteSucceed = await accounts.deletePath(path); const deleteSucceed = await accounts.deletePath(path);
const paths = Array.from(accounts.state.currentIdentity.meta.keys());
const listedPaths = getPathsWithSubstrateNetwork(paths, networkKey);
const hasOtherPaths = listedPaths.length > 0;
if (deleteSucceed) { if (deleteSucceed) {
isSubstratePath(path) && !isRootPath isSubstratePath(path) && !isRootPath && hasOtherPaths
? navigateToPathsList(navigation, networkKey) ? navigateToPathsList(navigation, networkKey)
: navigation.navigate('AccountNetworkChooser'); : navigation.navigate('AccountNetworkChooser');
} else { } else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment