aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-04-04 07:59:32 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-04-04 07:59:32 +0800
commitbf38aa6f1d793a0e18e64164a3a735e202ca34d6 (patch)
tree871b578a3626184ebfb949ba73386528603690e5 /ui
parent2e9273d2ac349f410e6cbc0d67ef48b3ef68e540 (diff)
downloadtangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar
tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.gz
tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.bz2
tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.lz
tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.xz
tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.tar.zst
tangerine-wallet-browser-bf38aa6f1d793a0e18e64164a3a735e202ca34d6.zip
Fix transaction confirmations
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/pages/home.js30
-rw-r--r--ui/app/conf-tx.js19
2 files changed, 32 insertions, 17 deletions
diff --git a/ui/app/components/pages/home.js b/ui/app/components/pages/home.js
index 177d9b4e7..7857a2a99 100644
--- a/ui/app/components/pages/home.js
+++ b/ui/app/components/pages/home.js
@@ -27,6 +27,22 @@ const {
} = require('../../routes')
class Home extends Component {
+ componentDidMount () {
+ const {
+ history,
+ unapprovedTxs = {},
+ unapprovedMsgCount = 0,
+ unapprovedPersonalMsgCount = 0,
+ unapprovedTypedMessagesCount = 0,
+ } = this.props
+
+ // unapprovedTxs and unapproved messages
+ if (Object.keys(unapprovedTxs).length ||
+ unapprovedTypedMessagesCount + unapprovedMsgCount + unapprovedPersonalMsgCount > 0) {
+ history.push(CONFIRM_TRANSACTION_ROUTE)
+ }
+ }
+
render () {
log.debug('rendering primary')
const {
@@ -36,10 +52,6 @@ class Home extends Component {
currentView,
activeAddress,
seedWords,
- unapprovedTxs = {},
- unapprovedMsgCount = 0,
- unapprovedPersonalMsgCount = 0,
- unapprovedTypedMessagesCount = 0,
} = this.props
// notices
@@ -70,16 +82,6 @@ class Home extends Component {
})
}
- // unapprovedTxs and unapproved messages
- if (Object.keys(unapprovedTxs).length ||
- unapprovedTypedMessagesCount + unapprovedMsgCount + unapprovedPersonalMsgCount > 0) {
- return h(Redirect, {
- to: {
- pathname: CONFIRM_TRANSACTION_ROUTE,
- },
- })
- }
-
// if (!props.noActiveNotices) {
// log.debug('rendering notice screen for unread notices.')
// return h(NoticeScreen, {
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 886d98be7..fee7cd36f 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -2,7 +2,7 @@ const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
-const { withRouter, Redirect } = require('react-router-dom')
+const { withRouter } = require('react-router-dom')
const { compose } = require('recompose')
const actions = require('./actions')
const txHelper = require('../lib/tx-helper')
@@ -25,6 +25,7 @@ function mapStateToProps (state) {
const {
unapprovedMsgCount,
unapprovedPersonalMsgCount,
+ unapprovedTypedMessagesCount,
} = metamask
return {
@@ -45,6 +46,7 @@ function mapStateToProps (state) {
computedBalances: state.metamask.computedBalances,
unapprovedMsgCount,
unapprovedPersonalMsgCount,
+ unapprovedTypedMessagesCount,
send: state.metamask.send,
selectedAddressTxList: state.metamask.selectedAddressTxList,
}
@@ -55,6 +57,16 @@ function ConfirmTxScreen () {
Component.call(this)
}
+ConfirmTxScreen.prototype.getUnapprovedMessagesTotal = function () {
+ const {
+ unapprovedMsgCount = 0,
+ unapprovedPersonalMsgCount = 0,
+ unapprovedTypedMessagesCount = 0,
+ } = this.props
+
+ return unapprovedTypedMessagesCount + unapprovedMsgCount + unapprovedPersonalMsgCount
+}
+
ConfirmTxScreen.prototype.componentDidMount = function () {
const {
unapprovedTxs = {},
@@ -63,7 +75,7 @@ ConfirmTxScreen.prototype.componentDidMount = function () {
} = this.props
const unconfTxList = txHelper(unapprovedTxs, {}, {}, {}, network)
- if (unconfTxList.length === 0 && !send.to) {
+ if (unconfTxList.length === 0 && !send.to && this.getUnapprovedMessagesTotal() === 0) {
this.props.history.push(DEFAULT_ROUTE)
}
}
@@ -81,7 +93,8 @@ ConfirmTxScreen.prototype.componentDidUpdate = function (prevProps) {
const prevTx = selectedAddressTxList.find(({ id }) => id === prevTxData.id) || {}
const unconfTxList = txHelper(unapprovedTxs, {}, {}, {}, network)
- if (unconfTxList.length === 0 && (prevTx.status === 'dropped' || !send.to)) {
+ if (unconfTxList.length === 0 &&
+ (prevTx.status === 'dropped' || !send.to && this.getUnapprovedMessagesTotal() === 0)) {
this.props.history.push(DEFAULT_ROUTE)
}
}