on master help sign in
Use static initialValues for mnemonic login form
f0d6c17Fang
src/views/Login/Mnemonic.js+3−11
@@ -5,7 +5,7 @@ import { Grid, CheckboxInput } from 'indigo-react';
5
5
6import { useWallet } from 'store/wallet';
6import { useWallet } from 'store/wallet';
7
7
8−import { walletFromMnemonic, WALLET_TYPES } from 'lib/wallet';
8+import { walletFromMnemonic, WALLET_TYPES, DEFAULT_HD_PATH } from 'lib/wallet';
9import useLoginView from 'lib/useLoginView';
9import useLoginView from 'lib/useLoginView';
10import { MnemonicInput, HdPathInput, PassphraseInput } from 'form/Inputs';
10import { MnemonicInput, HdPathInput, PassphraseInput } from 'form/Inputs';
11import {
11import {
@@ -23,12 +23,7 @@ import SubmitButton from 'form/SubmitButton';
23export default function Mnemonic({ className, goHome }) {
23export default function Mnemonic({ className, goHome }) {
24 useLoginView(WALLET_TYPES.MNEMONIC);
24 useLoginView(WALLET_TYPES.MNEMONIC);
25
25
26− const {
27− setWallet,
28− setAuthMnemonic,
26+ const { setWallet, setAuthMnemonic, setWalletHdPath } = useWallet();
29− walletHdPath,
30− setWalletHdPath,
31− } = useWallet();
32
27
33 const validate = useMemo(
28 const validate = useMemo(
34 () =>
29 () =>
@@ -58,10 +53,7 @@ export default function Mnemonic({ className, goHome }) {
58 [setAuthMnemonic, setWallet, setWalletHdPath]
53 [setAuthMnemonic, setWallet, setWalletHdPath]
59 );
54 );
60
55
61− const initialValues = useMemo(
62− () => ({ hdpath: walletHdPath, useAdvanced: false }),
56+ const initialValues = { hdpath: DEFAULT_HD_PATH, useAdvanced: false };
63− [walletHdPath]
64− );
65
57
66 return (
58 return (
67 <Grid className={cn('mt4', className)}>
59 <Grid className={cn('mt4', className)}>