aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Liang <simon@divby0.io>2017-08-10 11:06:37 +0800
committerSimon Liang <simon@divby0.io>2017-08-10 14:43:01 +0800
commit87cb930130cb43130bf584552451aad4795dd210 (patch)
tree0be300a24e8dbb43907084c2e23f284b37bd9919
parent9d36b25c5f11fccd0f3517901ff9cfc583cc3816 (diff)
downloadtangerine-wallet-browser-87cb930130cb43130bf584552451aad4795dd210.tar.gz
tangerine-wallet-browser-87cb930130cb43130bf584552451aad4795dd210.tar.zst
tangerine-wallet-browser-87cb930130cb43130bf584552451aad4795dd210.zip
moved the props initialization steps into mapStateToProps
-rw-r--r--ui/app/components/tx-list.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js
index 8f6f09348..8fa712b4a 100644
--- a/ui/app/components/tx-list.js
+++ b/ui/app/components/tx-list.js
@@ -7,12 +7,18 @@ const valuesFor = require('../util').valuesFor
module.exports = connect(mapStateToProps)(TxList)
-function mapStateToProps(state) {
+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
-
- 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)
+ const { txsToRender, conversionRate } = this.props
- console.log("transactions to render", txsToRender)
+ console.log('transactions to render', txsToRender)
return h('div.flex-column.tx-list-container', {}, [