on master help sign in
fix: additional race condition cases
commit2268655c517f9c44e6459238694791d99d0470de authortomholford <tomholford@users.noreply.github.com> dateTue 18 Oct 2022, 20:27 (4 years ago) parentb6399a0
3 files changed+42−3
src/store/pointCache.jsx+1 src/store/pointCursor.jsx+7−1 src/store/wallet.jsx+34−2
src/store/pointCache.jsx+1
@@ -18,6 +18,7 @@ const initialContext = {
1818 controlledPoints: Just(Result.Error('not yet loaded')),
1919 ecliptic: Nothing(),
2020 residents: Nothing(),
21+ pointCursor: Nothing(),
2122 syncDetails: noop,
2223 syncEclipticOwner:noop,
2324 syncRekeyDate: noop,
src/store/pointCursor.jsx+7−1
@@ -7,8 +7,14 @@ import React, {
77} from 'react';
88import { Nothing } from 'folktale/maybe';
99import { useRollerStore } from './rollerStore';
10+import { noop } from 'lodash';
1011
11−export const PointCursorContext = createContext(null);
12+const initialContext = {
13+ pointCursor: Nothing(),
14+ setPointCursor: noop,
15+}
16+
17+export const PointCursorContext = createContext(initialContext);
1218
1319// pointCursor is Maybe<number>
1420function _usePointCursor(initialPointCursor = Nothing()) {
src/store/wallet.jsx+34−2
@@ -7,7 +7,7 @@ import React, {
77 useEffect,
88} from 'react';
99import { Just, Nothing } from 'folktale/maybe';
10−import { includes } from 'lodash';
10+import { includes, noop } from 'lodash';
1111import { randomHex } from 'web3-utils';
1212
1313import { walletFromMnemonic } from 'lib/wallet';
@@ -22,7 +22,39 @@ import { BRIDGE_ERROR } from 'lib/error';
2222import { useNetwork } from 'store/network';
2323import { publicToAddress } from 'lib/utils/address';
2424
25−export const WalletContext = createContext(null);
25+const initialContext = {
26+ //
27+ walletType: Nothing(),
28+ setWalletType: noop,
29+ //
30+ walletHdPath: '',
31+ setWalletHdPath: noop,
32+ //
33+ wallet: Nothing(),
34+ setWallet: noop,
35+ //
36+ urbitWallet: Nothing(),
37+ setUrbitWallet: noop,
38+ authMnemonic: Nothing(),
39+ setAuthMnemonic: noop,
40+ //
41+ networkSeed: Nothing(),
42+ setNetworkSeed: noop,
43+ networkRevision: Nothing(),
44+ setNetworkRevision: noop,
45+ //
46+ resetWallet: noop,
47+ //
48+ authToken: Nothing(),
49+ setAuthToken: noop,
50+ useLegacyTokenSigning: Nothing(),
51+ setUseLegacyTokenSigning: noop,
52+ skipLoginSigning: false,
53+ setSkipLoginSigning: noop,
54+ setFakeToken: noop,
55+}
56+
57+export const WalletContext = createContext(initialContext);
2658
2759const DEFAULT_WALLET_TYPE = WALLET_TYPES.TICKET;
2860