Merge pull request #261 from poanetwork/hd-wallet-release-timeout

(Fix) Clear timeout on componentWillUnmount in connect hardware screen
This commit is contained in:
Victor Baranov 2019-02-08 19:02:34 +03:00 committed by GitHub
commit f0c390051a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import { LEDGER, TREZOR } from './enum'
class ConnectHardwareForm extends Component {
constructor (props, context) {
super(props)
this.timerID = null
this.state = {
error: null,
selectedAccount: null,
@ -35,6 +36,9 @@ class ConnectHardwareForm extends Component {
this.setState({accounts: newAccounts})
}
componentWillUnmount () {
clearTimeout(this.timerID)
}
componentDidMount () {
this.checkIfUnlocked()
@ -96,7 +100,7 @@ class ConnectHardwareForm extends Component {
showTemporaryAlert () {
this.props.showAlert('Hardware wallet connected')
// Autohide the alert after 5 seconds
setTimeout(_ => {
this.timerID = setTimeout(_ => {
this.props.hideAlert()
}, 5000)
}