mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #5155 from MetaMask/i5154-confirm-spinner
Fix infinite spinner on failed transactions
This commit is contained in:
commit
9ab0354e36
@ -1150,6 +1150,10 @@ function updateAndApproveTx (txData) {
|
|||||||
|
|
||||||
return txData
|
return txData
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
dispatch(actions.hideLoadingIndication())
|
||||||
|
return Promise.reject(err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ const ConfirmPageContainerError = (props, context) => {
|
|||||||
src="/images/alert-red.svg"
|
src="/images/alert-red.svg"
|
||||||
className="confirm-page-container-error__icon"
|
className="confirm-page-container-error__icon"
|
||||||
/>
|
/>
|
||||||
{ `ALERT: ${error}` }
|
<div className="confirm-page-container-error__text">
|
||||||
|
{ `ALERT: ${error}` }
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.confirm-page-container-error {
|
.confirm-page-container-error {
|
||||||
height: 32px;
|
min-height: 32px;
|
||||||
border: 1px solid $monzo;
|
border: 1px solid $monzo;
|
||||||
color: $monzo;
|
color: $monzo;
|
||||||
background: lighten($monzo, 56%);
|
background: lighten($monzo, 56%);
|
||||||
@ -8,10 +8,14 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 16px;
|
padding: 8px 16px;
|
||||||
|
|
||||||
&__icon {
|
&__icon {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,7 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
|
|
||||||
state = {
|
state = {
|
||||||
submitting: false,
|
submitting: false,
|
||||||
|
submitError: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate () {
|
componentDidUpdate () {
|
||||||
@ -268,7 +269,7 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ submitting: true })
|
this.setState({ submitting: true, submitError: null })
|
||||||
|
|
||||||
if (onSubmit) {
|
if (onSubmit) {
|
||||||
Promise.resolve(onSubmit(txData))
|
Promise.resolve(onSubmit(txData))
|
||||||
@ -280,7 +281,9 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
this.setState({ submitting: false })
|
this.setState({ submitting: false })
|
||||||
history.push(DEFAULT_ROUTE)
|
history.push(DEFAULT_ROUTE)
|
||||||
})
|
})
|
||||||
.catch(() => this.setState({ submitting: false }))
|
.catch(error => {
|
||||||
|
this.setState({ submitting: false, submitError: error.message })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +312,7 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
nonce,
|
nonce,
|
||||||
warning,
|
warning,
|
||||||
} = this.props
|
} = this.props
|
||||||
const { submitting } = this.state
|
const { submitting, submitError } = this.state
|
||||||
|
|
||||||
const { name } = methodData
|
const { name } = methodData
|
||||||
const fiatConvertedAmount = formatCurrency(fiatTransactionAmount, currentCurrency)
|
const fiatConvertedAmount = formatCurrency(fiatTransactionAmount, currentCurrency)
|
||||||
@ -332,7 +335,7 @@ export default class ConfirmTransactionBase extends Component {
|
|||||||
contentComponent={contentComponent}
|
contentComponent={contentComponent}
|
||||||
nonce={nonce}
|
nonce={nonce}
|
||||||
identiconAddress={identiconAddress}
|
identiconAddress={identiconAddress}
|
||||||
errorMessage={errorMessage}
|
errorMessage={errorMessage || submitError}
|
||||||
errorKey={propsErrorKey || errorKey}
|
errorKey={propsErrorKey || errorKey}
|
||||||
warning={warning}
|
warning={warning}
|
||||||
disabled={!propsValid || !valid || submitting}
|
disabled={!propsValid || !valid || submitting}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user