diff --git a/src/renderer/components/+cluster-settings/components/install-feature.tsx b/src/renderer/components/+cluster-settings/components/install-feature.tsx index b185f906a9..db4fd16173 100644 --- a/src/renderer/components/+cluster-settings/components/install-feature.tsx +++ b/src/renderer/components/+cluster-settings/components/install-feature.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { observable } from "mobx"; -import { observer } from "mobx-react"; +import { observable, reaction } from "mobx"; +import { observer, disposeOnUnmount } from "mobx-react"; import { clusterIpc } from "../../../../common/cluster-ipc"; import { Cluster } from "../../../../main/cluster"; import { Button } from "../../button"; @@ -16,6 +16,14 @@ interface Props { export class InstallFeature extends React.Component { @observable loading = false; + componentDidMount() { + disposeOnUnmount(this, [ + reaction(() => this.props.cluster.features[this.props.feature], () => { + this.loading = false; + }) + ]); + } + getActionButtons() { const { cluster, feature } = this.props; const features = cluster.features[feature]; @@ -65,14 +73,12 @@ export class InstallFeature extends React.Component { runAction(action: () => Promise): () => Promise { return async () => { - const { cluster, feature } = this.props; try { this.loading = true; await action(); } catch (err) { Notifications.error(err.toString()); } - this.loading = false; }; }