mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Never disable save button if props chain ID is invalid (#9808)
This commit is contained in:
parent
6426816411
commit
efd36adaac
@ -198,7 +198,13 @@ export default class NetworkForm extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stateIsUnchanged() {
|
stateIsUnchanged() {
|
||||||
const { rpcUrl, ticker, networkName, blockExplorerUrl } = this.props
|
const {
|
||||||
|
rpcUrl,
|
||||||
|
chainId: propsChainId,
|
||||||
|
ticker,
|
||||||
|
networkName,
|
||||||
|
blockExplorerUrl,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
const {
|
const {
|
||||||
rpcUrl: stateRpcUrl,
|
rpcUrl: stateRpcUrl,
|
||||||
@ -208,9 +214,17 @@ export default class NetworkForm extends PureComponent {
|
|||||||
blockExplorerUrl: stateBlockExplorerUrl,
|
blockExplorerUrl: stateBlockExplorerUrl,
|
||||||
} = this.state
|
} = this.state
|
||||||
|
|
||||||
|
// These added conditions are in case the saved chainId is invalid, which
|
||||||
|
// was possible in versions <8.1 of the extension.
|
||||||
|
// Basically, we always want to be able to overwrite an invalid chain ID.
|
||||||
|
const chainIdIsUnchanged =
|
||||||
|
typeof propsChainId === 'string' &&
|
||||||
|
propsChainId.toLowerCase().startsWith('0x') &&
|
||||||
|
stateChainId === this.getDisplayChainIdFromProps()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
stateRpcUrl === rpcUrl &&
|
stateRpcUrl === rpcUrl &&
|
||||||
stateChainId === this.getDisplayChainIdFromProps() &&
|
chainIdIsUnchanged &&
|
||||||
stateTicker === ticker &&
|
stateTicker === ticker &&
|
||||||
stateNetworkName === networkName &&
|
stateNetworkName === networkName &&
|
||||||
stateBlockExplorerUrl === blockExplorerUrl
|
stateBlockExplorerUrl === blockExplorerUrl
|
||||||
|
Loading…
Reference in New Issue
Block a user