Tighten web3 network change refresh validation (#2014)

* Add a check to make sure a network even exists on the web3Wallet instance

* Format snap files
This commit is contained in:
Connor Bryan 2018-07-05 12:29:23 -05:00 committed by Daniel Ternyak
parent bb2965e4df
commit e68e3ccc2f
3 changed files with 13 additions and 4 deletions

View File

@ -12,7 +12,9 @@ Object {
}
`;
exports[`handleChangeNodeRequested* should select getCustomNodeConfig and match race snapshot 1`] = `
exports[
`handleChangeNodeRequested* should select getCustomNodeConfig and match race snapshot 1`
] = `
Object {
"@@redux-saga/IO": true,
"SELECT": Object {

View File

@ -1,6 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`getDeterministicWallets* starting from publicKey & chainCode should match put snapshot 1`] = `
exports[
`getDeterministicWallets* starting from publicKey & chainCode should match put snapshot 1`
] = `
Object {
"@@redux-saga/IO": true,
"PUT": Object {
@ -215,4 +217,4 @@ Object {
},
],
}
`;
`;

View File

@ -37,7 +37,12 @@ export default async function handleMetaMaskPolling(store: Store<AppState>): Pro
const actualChainId = await getActualChainId();
const actualNetwork = configNetworksSelectors.getNetworkByChainId(state, actualChainId);
if (web3Wallet && actualNetwork && (web3Wallet as Web3Wallet).network !== actualNetwork.id) {
if (
web3Wallet &&
(web3Wallet as Web3Wallet).network &&
actualNetwork &&
(web3Wallet as Web3Wallet).network !== actualNetwork.id
) {
window.location.reload();
return true;