diff --git a/common/components/ui/UnlockHeader.tsx b/common/components/ui/UnlockHeader.tsx index 733c5c13..df750cde 100644 --- a/common/components/ui/UnlockHeader.tsx +++ b/common/components/ui/UnlockHeader.tsx @@ -20,7 +20,7 @@ export class UnlockHeader extends React.Component { }; public componentDidUpdate(prevProps: Props) { - if (this.props.wallet && this.props.wallet !== prevProps.wallet) { + if (this.props.wallet !== prevProps.wallet) { this.setState({ isExpanded: !this.state.isExpanded }); } } diff --git a/common/sagas/config.ts b/common/sagas/config.ts index 08e927b5..ba72d093 100644 --- a/common/sagas/config.ts +++ b/common/sagas/config.ts @@ -41,6 +41,8 @@ import { IWallet, Web3Wallet } from 'libs/wallet'; import { getWalletInst } from 'selectors/wallet'; import { TypeKeys as WalletTypeKeys } from 'actions/wallet/constants'; import { State as ConfigState, INITIAL_STATE as configInitialState } from 'reducers/config'; +import { resetWallet } from 'actions/wallet'; +import { reset as resetTransaction } from 'actions/transaction'; export const getConfig = (state: AppState): ConfigState => state.config; @@ -173,7 +175,8 @@ export function* handleNodeChangeIntent(action: ChangeNodeIntentAction): SagaIte // if there's no wallet, do not reload as there's no component state to resync if (currentWallet && currentConfig.network !== actionConfig.network) { - yield call(reload); + yield put(resetWallet()); + yield put(resetTransaction()); } } diff --git a/spec/sagas/config.spec.ts b/spec/sagas/config.spec.ts index 7b03eb36..478a33a2 100644 --- a/spec/sagas/config.spec.ts +++ b/spec/sagas/config.spec.ts @@ -7,7 +7,6 @@ import { pollOfflineStatus, handlePollOfflineStatus, handleNodeChangeIntent, - reload, unsetWeb3Node, unsetWeb3NodeOnWalletEvent, equivalentNodeOrDefault @@ -26,7 +25,8 @@ import { Web3Wallet } from 'libs/wallet'; import { RPCNode } from 'libs/nodes'; import { showNotification } from 'actions/notifications'; import { translateRaw } from 'translations'; - +import { resetWallet } from 'actions/wallet'; +import { reset as resetTransaction } from 'actions/transaction'; // init module configuredStore.getState(); @@ -214,7 +214,8 @@ describe('handleNodeChangeIntent*', () => { it('should call reload if wallet exists and network is new', () => { data.clone2 = data.gen.clone(); - expect(data.clone2.next(truthyWallet).value).toEqual(call(reload)); + expect(data.clone2.next(truthyWallet).value).toEqual(put(resetWallet())); + expect(data.clone2.next(truthyWallet).value).toEqual(put(resetTransaction())); expect(data.clone2.next().done).toEqual(true); });