diff --git a/src/components/SettingsPage/RepairDeviceButton.js b/src/components/SettingsPage/RepairDeviceButton.js index 151e0e8f..b36e6254 100644 --- a/src/components/SettingsPage/RepairDeviceButton.js +++ b/src/components/SettingsPage/RepairDeviceButton.js @@ -33,6 +33,12 @@ class RepairDeviceButton extends PureComponent { progress: 0, } + componentWillUnmount() { + if (this.timeout) { + clearTimeout(this.timeout) + } + } + open = () => this.setState({ opened: true, error: null }) sub: * @@ -45,7 +51,7 @@ class RepairDeviceButton extends PureComponent { repair = (version = null) => { if (this.state.isLoading) return const { push } = this.props - this.setState({ isLoading: true }) + this.timeout = setTimeout(() => this.setState({ isLoading: true }), 500) this.sub = firmwareRepair.send({ version }).subscribe({ next: patch => { this.setState(patch)