From 828aa6250d9ef6af87081e28b45f5620ad17ebe8 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Tue, 5 Feb 2019 16:18:27 +0100 Subject: [PATCH] LL-832 remove flashing screen in repair tool --- src/components/SettingsPage/RepairDeviceButton.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)