Fix isMounted

This commit is contained in:
Scott E. Graves
2019-06-28 15:37:46 -05:00
parent 96908fc4cd
commit e2b9037be1

View File

@@ -20,6 +20,8 @@ class Configuration extends IPCContainer {
this.setRequestHandler(Constants.IPC_Set_Config_Values_Reply, this.onSetConfigValuesReply);
}
_isMounted = false;
state = {
ChangedItems: [],
ChangedObjectLookup: null,
@@ -70,12 +72,18 @@ class Configuration extends IPCContainer {
};
componentDidMount() {
this._isMounted = true;
this.sendRequest(Constants.IPC_Get_Config_Template, {
Provider: this.props.DisplayConfiguration,
Version: this.props.version,
});
}
componentWillUnmount() {
this._isMounted = false;
super.componentWillUnmount();
}
createItemList = (config, template) => {
const objectList = [];
const itemList = Object
@@ -162,7 +170,7 @@ class Configuration extends IPCContainer {
});
} else {
this.props.notifyError(arg.data.Error, false, () => {
if (this.isMounted()) {
if (this._isMounted) {
this.props.hideConfiguration();
}
});