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:
parent
70a689410a
commit
b90b30f706
@ -1,5 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { compose } from 'recompose'
|
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { hideSidebar, showModal } from '../../../store/actions'
|
import { hideSidebar, showModal } from '../../../store/actions'
|
||||||
import AccountDetails from './account-details.component'
|
import AccountDetails from './account-details.component'
|
||||||
@ -13,9 +12,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const AccountDetailsContainer = compose(
|
const AccountDetailsContainer = connect(null, mapDispatchToProps)(AccountDetails)
|
||||||
connect(null, mapDispatchToProps)
|
|
||||||
)(AccountDetails)
|
|
||||||
|
|
||||||
AccountDetailsContainer.propTypes = {
|
AccountDetailsContainer.propTypes = {
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { compose } from 'recompose'
|
|
||||||
|
|
||||||
import ConnectedSitesList from './connected-sites-list.component'
|
import ConnectedSitesList from './connected-sites-list.component'
|
||||||
import {
|
import {
|
||||||
@ -52,6 +51,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps, mapDispatchToProps)(ConnectedSitesList)
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
|
||||||
)(ConnectedSitesList)
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { compose } from 'recompose'
|
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import PermissionPageContainer from './permission-page-container.component'
|
import PermissionPageContainer from './permission-page-container.component'
|
||||||
import {
|
import {
|
||||||
getPermissionsDescriptions,
|
getPermissionsDescriptions,
|
||||||
@ -22,7 +20,4 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps)(PermissionPageContainer)
|
||||||
withRouter,
|
|
||||||
connect(mapStateToProps)
|
|
||||||
)(PermissionPageContainer)
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import { compose } from 'recompose'
|
|
||||||
import SignatureRequest from './signature-request.component'
|
import SignatureRequest from './signature-request.component'
|
||||||
import { goHome } from '../../../store/actions'
|
import { goHome } from '../../../store/actions'
|
||||||
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
|
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
|
||||||
@ -66,7 +64,4 @@ function mergeProps (stateProps, dispatchProps, ownProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(SignatureRequest)
|
||||||
withRouter,
|
|
||||||
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
||||||
)(SignatureRequest)
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import { compose } from 'recompose'
|
|
||||||
import TransactionList from './transaction-list.component'
|
import TransactionList from './transaction-list.component'
|
||||||
import {
|
import {
|
||||||
nonceSortedCompletedTransactionsSelector,
|
nonceSortedCompletedTransactionsSelector,
|
||||||
@ -45,7 +43,4 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(TransactionList)
|
||||||
withRouter,
|
|
||||||
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
||||||
)(TransactionList)
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import { compose } from 'recompose'
|
|
||||||
import TransactionTimeRemaining from './transaction-time-remaining.component'
|
import TransactionTimeRemaining from './transaction-time-remaining.component'
|
||||||
import {
|
import {
|
||||||
getTxParams,
|
getTxParams,
|
||||||
@ -31,10 +29,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps)(TransactionTimeRemaining)
|
||||||
withRouter,
|
|
||||||
connect(mapStateToProps)
|
|
||||||
)(TransactionTimeRemaining)
|
|
||||||
|
|
||||||
function calcCustomGasPrice (customGasPriceInHex) {
|
function calcCustomGasPrice (customGasPriceInHex) {
|
||||||
return Number(hexWEIToDecGWEI(customGasPriceInHex))
|
return Number(hexWEIToDecGWEI(customGasPriceInHex))
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { Component } from 'react'
|
import { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { withRouter } from 'react-router-dom'
|
|
||||||
import { compose } from 'recompose'
|
|
||||||
import { getMessage } from '../utils/i18n-helper'
|
import { getMessage } from '../utils/i18n-helper'
|
||||||
|
|
||||||
class I18nProvider extends Component {
|
class I18nProvider extends Component {
|
||||||
@ -59,8 +57,4 @@ const mapStateToProps = state => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps)(I18nProvider)
|
||||||
withRouter,
|
|
||||||
connect(mapStateToProps)
|
|
||||||
)(I18nProvider)
|
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { compose } from 'recompose'
|
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import PermissionApproval from './permissions-connect.component'
|
import PermissionApproval from './permissions-connect.component'
|
||||||
import {
|
import {
|
||||||
@ -63,9 +62,7 @@ const mapDispatchToProps = dispatch => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PermissionApprovalContainer = compose(
|
const PermissionApprovalContainer = connect(mapStateToProps, mapDispatchToProps)(PermissionApproval)
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
|
||||||
)(PermissionApproval)
|
|
||||||
|
|
||||||
PermissionApprovalContainer.propTypes = {
|
PermissionApprovalContainer.propTypes = {
|
||||||
history: PropTypes.object.isRequired,
|
history: PropTypes.object.isRequired,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import SettingsTab from './settings-tab.component'
|
import SettingsTab from './settings-tab.component'
|
||||||
import { compose } from 'recompose'
|
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import {
|
import {
|
||||||
setCurrentCurrency,
|
setCurrentCurrency,
|
||||||
@ -44,6 +43,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default connect(mapStateToProps, mapDispatchToProps)(SettingsTab)
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
|
||||||
)(SettingsTab)
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
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 TabBar from '../../components/app/tab-bar'
|
||||||
import c from 'classnames'
|
import c from 'classnames'
|
||||||
import SettingsTab from './settings-tab'
|
import SettingsTab from './settings-tab'
|
||||||
@ -244,4 +244,4 @@ class SettingsPage extends PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRouter(SettingsPage)
|
export default SettingsPage
|
||||||
|
Loading…
Reference in New Issue
Block a user