Fix changed detection
This commit is contained in:
@@ -27,11 +27,21 @@ class Configuration extends IPCContainer {
|
||||
Template: {}
|
||||
};
|
||||
|
||||
checkItemChanged = (itemA, itemB) => {
|
||||
if (itemA.type === 'string_array') {
|
||||
if (itemA.value.length !== itemB.value.length) {
|
||||
return true;
|
||||
}
|
||||
return itemA.value.filter(i => !itemB.value.includes(i)).length !== 0;
|
||||
}
|
||||
return itemA.value !== itemB.value;
|
||||
};
|
||||
|
||||
checkSaveRequired = () => {
|
||||
const changedItems = [];
|
||||
let i = 0;
|
||||
for (const item of this.state.ItemList) {
|
||||
if (this.state.OriginalItemList[i++].value !== item.value) {
|
||||
if (this.checkItemChanged(this.state.OriginalItemList[i++], item)) {
|
||||
changedItems.push(item);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +51,7 @@ class Configuration extends IPCContainer {
|
||||
const changedObjectItems = [];
|
||||
let j = 0;
|
||||
for (const item of this.state.ObjectLookup[key]) {
|
||||
if (this.state.OriginalObjectLookup[key][j++].value !== item.value) {
|
||||
if (this.checkItemChanged(this.state.OriginalObjectLookup[key][j++], item)) {
|
||||
changedObjectItems.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user