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