1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Remove unnecessary withRouter and compose calls (#7890)

`withRouter` has been removed from any components that were not using
any of the three props injected by `withRouter`: `history`, `location`,
and `match`.

`compose` is a no-op when called upon a single component, so it has
been removed in all such cases.
This commit is contained in:
Mark Stacey 2020-01-24 15:12:49 -04:00 committed by GitHub
parent 70a689410a
commit b90b30f706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 11 additions and 49 deletions

View File

@ -1,5 +1,4 @@
import { connect } from 'react-redux'
import { compose } from 'recompose'
import PropTypes from 'prop-types'
import { hideSidebar, showModal } from '../../../store/actions'
import AccountDetails from './account-details.component'
@ -13,9 +12,7 @@ function mapDispatchToProps (dispatch) {
}
}
const AccountDetailsContainer = compose(
connect(null, mapDispatchToProps)
)(AccountDetails)
const AccountDetailsContainer = connect(null, mapDispatchToProps)(AccountDetails)
AccountDetailsContainer.propTypes = {
label: PropTypes.string.isRequired,

View File

@ -1,5 +1,4 @@
import { connect } from 'react-redux'
import { compose } from 'recompose'
import ConnectedSitesList from './connected-sites-list.component'
import {
@ -52,6 +51,4 @@ const mapDispatchToProps = dispatch => {
}
}
export default compose(
connect(mapStateToProps, mapDispatchToProps)
)(ConnectedSitesList)
export default connect(mapStateToProps, mapDispatchToProps)(ConnectedSitesList)

View File

@ -1,6 +1,4 @@
import { connect } from 'react-redux'
import { compose } from 'recompose'
import { withRouter } from 'react-router-dom'
import PermissionPageContainer from './permission-page-container.component'
import {
getPermissionsDescriptions,
@ -22,7 +20,4 @@ const mapStateToProps = (state, ownProps) => {
}
}
export default compose(
withRouter,
connect(mapStateToProps)
)(PermissionPageContainer)
export default connect(mapStateToProps)(PermissionPageContainer)

View File

@ -1,6 +1,4 @@
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import SignatureRequest from './signature-request.component'
import { goHome } from '../../../store/actions'
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
@ -66,7 +64,4 @@ function mergeProps (stateProps, dispatchProps, ownProps) {
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps, mergeProps)
)(SignatureRequest)
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(SignatureRequest)

View File

@ -1,6 +1,4 @@
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import TransactionList from './transaction-list.component'
import {
nonceSortedCompletedTransactionsSelector,
@ -45,7 +43,4 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps, mergeProps)
)(TransactionList)
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(TransactionList)

View File

@ -1,6 +1,4 @@
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import TransactionTimeRemaining from './transaction-time-remaining.component'
import {
getTxParams,
@ -31,10 +29,7 @@ const mapStateToProps = (state, ownProps) => {
}
}
export default compose(
withRouter,
connect(mapStateToProps)
)(TransactionTimeRemaining)
export default connect(mapStateToProps)(TransactionTimeRemaining)
function calcCustomGasPrice (customGasPriceInHex) {
return Number(hexWEIToDecGWEI(customGasPriceInHex))

View File

@ -1,8 +1,6 @@
import { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import { getMessage } from '../utils/i18n-helper'
class I18nProvider extends Component {
@ -59,8 +57,4 @@ const mapStateToProps = state => {
}
}
export default compose(
withRouter,
connect(mapStateToProps)
)(I18nProvider)
export default connect(mapStateToProps)(I18nProvider)

View File

@ -1,5 +1,4 @@
import { connect } from 'react-redux'
import { compose } from 'recompose'
import PropTypes from 'prop-types'
import PermissionApproval from './permissions-connect.component'
import {
@ -63,9 +62,7 @@ const mapDispatchToProps = dispatch => {
}
}
const PermissionApprovalContainer = compose(
connect(mapStateToProps, mapDispatchToProps)
)(PermissionApproval)
const PermissionApprovalContainer = connect(mapStateToProps, mapDispatchToProps)(PermissionApproval)
PermissionApprovalContainer.propTypes = {
history: PropTypes.object.isRequired,

View File

@ -1,5 +1,4 @@
import SettingsTab from './settings-tab.component'
import { compose } from 'recompose'
import { connect } from 'react-redux'
import {
setCurrentCurrency,
@ -44,6 +43,4 @@ const mapDispatchToProps = dispatch => {
}
}
export default compose(
connect(mapStateToProps, mapDispatchToProps)
)(SettingsTab)
export default connect(mapStateToProps, mapDispatchToProps)(SettingsTab)

View File

@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { Switch, Route, matchPath, withRouter } from 'react-router-dom'
import { Switch, Route, matchPath } from 'react-router-dom'
import TabBar from '../../components/app/tab-bar'
import c from 'classnames'
import SettingsTab from './settings-tab'
@ -244,4 +244,4 @@ class SettingsPage extends PureComponent {
}
}
export default withRouter(SettingsPage)
export default SettingsPage