mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
moved the props initialization steps into mapStateToProps
This commit is contained in:
parent
9d36b25c5f
commit
87cb930130
@ -8,11 +8,17 @@ const valuesFor = require('../util').valuesFor
|
||||
module.exports = connect(mapStateToProps)(TxList)
|
||||
|
||||
function mapStateToProps (state) {
|
||||
const network = state.metamask.network
|
||||
const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs)
|
||||
|
||||
const shapeShiftTxList = (network === '1') ? state.metamask.shapeShiftTxList : undefined
|
||||
const transactions = state.metamask.selectedAddressTxList || []
|
||||
|
||||
const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
|
||||
.sort((a, b) => b.time - a.time)
|
||||
|
||||
return {
|
||||
network: state.metamask.network,
|
||||
unapprovedMsgs: valuesFor(state.metamask.unapprovedMsgs),
|
||||
shapeShiftTxList: state.metamask.shapeShiftTxList,
|
||||
transactions: state.metamask.selectedAddressTxList || [],
|
||||
txsToRender,
|
||||
conversionRate: state.metamask.conversionRate,
|
||||
}
|
||||
}
|
||||
@ -33,16 +39,9 @@ const contentDivider = h('div', {
|
||||
|
||||
TxList.prototype.render = function () {
|
||||
|
||||
const { transactions, network, unapprovedMsgs, conversionRate } = this.props
|
||||
const { txsToRender, conversionRate } = this.props
|
||||
|
||||
var shapeShiftTxList
|
||||
if (network === '1') {
|
||||
shapeShiftTxList = this.props.shapeShiftTxList
|
||||
}
|
||||
const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
|
||||
.sort((a, b) => b.time - a.time)
|
||||
|
||||
console.log("transactions to render", txsToRender)
|
||||
console.log('transactions to render', txsToRender)
|
||||
|
||||
return h('div.flex-column.tx-list-container', {}, [
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user