1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Override ownProps with state props in SignatureRequest (#6911)

The `accounts` prop of `SignatureRequest` was throwing a PropType
warning because `accounts` was an object instead of an array. It looks
like when the `mergeProps` function was added in #6340, the ownProps
were accidentally set to override the state props.

The now ignored props have been removed from the parent `ConfirmTxScreen`
component as well. `conversionRate` was identical to the one retrieved
in `SignatureRequest`, and `selectedAddress` differed only in the
fallback behaviour when `state.metamask.selectedAddress` does not exist;
it will now default to the first account instead (as was the original
behavior, prior to #6340).
This commit is contained in:
Mark Stacey 2019-07-26 10:39:13 -03:00 committed by GitHub
parent 1112277cd6
commit 1f45798707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 9 deletions

View File

@ -74,9 +74,9 @@ function mergeProps (stateProps, dispatchProps, ownProps) {
} }
return { return {
...ownProps,
...stateProps, ...stateProps,
...dispatchProps, ...dispatchProps,
...ownProps,
txData, txData,
cancel, cancel,
sign, sign,

View File

@ -12,7 +12,6 @@ const R = require('ramda')
const SignatureRequest = require('../../components/app/signature-request') const SignatureRequest = require('../../components/app/signature-request')
const Loading = require('../../components/ui/loading-screen') const Loading = require('../../components/ui/loading-screen')
const { DEFAULT_ROUTE } = require('../../helpers/constants/routes') const { DEFAULT_ROUTE } = require('../../helpers/constants/routes')
const { getMetaMaskAccounts } = require('../../selectors/selectors')
module.exports = compose( module.exports = compose(
withRouter, withRouter,
@ -29,8 +28,6 @@ function mapStateToProps (state) {
return { return {
identities: state.metamask.identities, identities: state.metamask.identities,
accounts: getMetaMaskAccounts(state),
selectedAddress: state.metamask.selectedAddress,
unapprovedTxs: state.metamask.unapprovedTxs, unapprovedTxs: state.metamask.unapprovedTxs,
unapprovedMsgs: state.metamask.unapprovedMsgs, unapprovedMsgs: state.metamask.unapprovedMsgs,
unapprovedPersonalMsgs: state.metamask.unapprovedPersonalMsgs, unapprovedPersonalMsgs: state.metamask.unapprovedPersonalMsgs,
@ -39,7 +36,6 @@ function mapStateToProps (state) {
warning: state.appState.warning, warning: state.appState.warning,
network: state.metamask.network, network: state.metamask.network,
provider: state.metamask.provider, provider: state.metamask.provider,
conversionRate: state.metamask.conversionRate,
currentCurrency: state.metamask.currentCurrency, currentCurrency: state.metamask.currentCurrency,
blockGasLimit: state.metamask.currentBlockGasLimit, blockGasLimit: state.metamask.currentBlockGasLimit,
computedBalances: state.metamask.computedBalances, computedBalances: state.metamask.computedBalances,
@ -146,7 +142,6 @@ ConfirmTxScreen.prototype.render = function () {
const props = this.props const props = this.props
const { const {
currentCurrency, currentCurrency,
conversionRate,
blockGasLimit, blockGasLimit,
} = props } = props
@ -159,10 +154,7 @@ ConfirmTxScreen.prototype.render = function () {
// Properties // Properties
txData: txData, txData: txData,
key: txData.id, key: txData.id,
selectedAddress: props.selectedAddress,
accounts: props.accounts,
identities: props.identities, identities: props.identities,
conversionRate,
currentCurrency, currentCurrency,
blockGasLimit, blockGasLimit,
// Actions // Actions