hotfix: remove didMount from daemon hoc
This commit is contained in:
parent
6393a4656b
commit
9100665042
|
@ -21,14 +21,7 @@ export const withDaemonStatusCheck = <PassedProps: {}>(
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.runTest();
|
this.runTest();
|
||||||
|
|
||||||
this.timer = setInterval(() => this.runTest(), 3000);
|
this.timer = setInterval(this.runTest, 2000);
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props, prevState: State) {
|
|
||||||
if (!prevState.isRunning && this.state.isRunning && this.timer) {
|
|
||||||
clearInterval(this.timer);
|
|
||||||
this.timer = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -38,11 +31,17 @@ export const withDaemonStatusCheck = <PassedProps: {}>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runTest() {
|
runTest = () => {
|
||||||
rpc.getinfo().then((response) => {
|
rpc.getinfo().then((response) => {
|
||||||
if (response) this.setState(() => ({ isRunning: true }));
|
if (response) {
|
||||||
});
|
this.setState(() => ({ isRunning: true }));
|
||||||
|
if (this.timer) {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.isRunning) {
|
if (this.state.isRunning) {
|
||||||
|
|
Loading…
Reference in New Issue