mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Ensure home screen does not render if there are unapproved txs (#6501)
* Ensure that the confirm screen renders before the home screen if there are unapproved txs. * Only render confirm screen before home screen on mount.
This commit is contained in:
parent
0dac3eb095
commit
39b7145423
@ -99,15 +99,18 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
submitError: null,
|
submitError: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate () {
|
componentDidUpdate (prevProps) {
|
||||||
const {
|
const {
|
||||||
transactionStatus,
|
transactionStatus,
|
||||||
showTransactionConfirmedModal,
|
showTransactionConfirmedModal,
|
||||||
history,
|
history,
|
||||||
clearConfirmTransaction,
|
clearConfirmTransaction,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
const { transactionStatus: prevTxStatus } = prevProps
|
||||||
|
const statusUpdated = transactionStatus !== prevTxStatus
|
||||||
|
const txDroppedOrConfirmed = transactionStatus === DROPPED_STATUS || transactionStatus === CONFIRMED_STATUS
|
||||||
|
|
||||||
if (transactionStatus === DROPPED_STATUS || transactionStatus === CONFIRMED_STATUS) {
|
if (statusUpdated && txDroppedOrConfirmed) {
|
||||||
showTransactionConfirmedModal({
|
showTransactionConfirmedModal({
|
||||||
onSubmit: () => {
|
onSubmit: () => {
|
||||||
clearConfirmTransaction()
|
clearConfirmTransaction()
|
||||||
|
@ -23,21 +23,27 @@ export default class Home extends PureComponent {
|
|||||||
providerRequests: PropTypes.array,
|
providerRequests: PropTypes.array,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillMount () {
|
||||||
|
const {
|
||||||
|
history,
|
||||||
|
unconfirmedTransactionsCount = 0,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
|
if (unconfirmedTransactionsCount > 0) {
|
||||||
|
history.push(CONFIRM_TRANSACTION_ROUTE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const {
|
const {
|
||||||
history,
|
history,
|
||||||
suggestedTokens = {},
|
suggestedTokens = {},
|
||||||
unconfirmedTransactionsCount = 0,
|
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
// suggested new tokens
|
// suggested new tokens
|
||||||
if (Object.keys(suggestedTokens).length > 0) {
|
if (Object.keys(suggestedTokens).length > 0) {
|
||||||
history.push(CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE)
|
history.push(CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unconfirmedTransactionsCount > 0) {
|
|
||||||
history.push(CONFIRM_TRANSACTION_ROUTE)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@ -45,6 +51,7 @@ export default class Home extends PureComponent {
|
|||||||
forgottenPassword,
|
forgottenPassword,
|
||||||
seedWords,
|
seedWords,
|
||||||
providerRequests,
|
providerRequests,
|
||||||
|
history,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
// seed words
|
// seed words
|
||||||
@ -69,7 +76,7 @@ export default class Home extends PureComponent {
|
|||||||
query="(min-width: 576px)"
|
query="(min-width: 576px)"
|
||||||
render={() => <WalletView />}
|
render={() => <WalletView />}
|
||||||
/>
|
/>
|
||||||
<TransactionView />
|
{ !history.location.pathname.match(/^\/confirm-transaction/) ? <TransactionView /> : null }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user