Replace flawed objectHasValueChange usage with objectHasDiff

Fixes https://github.com/vector-im/riot-web/issues/14782

We need to check if the keys changed, not just the values.
This commit is contained in:
Travis Ralston 2020-07-30 14:08:18 -06:00
parent e810a31fe3
commit e953bfbf88
2 changed files with 3 additions and 17 deletions

View file

@ -58,20 +58,6 @@ export function objectShallowClone(a: any, propertyCloner?: (k: string, v: any)
return newObj;
}
/**
* Determines if the two objects, which are assumed to be of the same
* key shape, have a difference in their values. If a difference is
* determined, true is returned.
* @param a The first object. Must be defined.
* @param b The second object. Must be defined.
* @returns True if there's a perceptual difference in the object's values.
*/
export function objectHasValueChange(a: any, b: any): boolean {
const aValues = Object.values(a);
const bValues = Object.values(b);
return arrayHasDiff(aValues, bValues);
}
/**
* Determines if any keys were added, removed, or changed between two objects.
* For changes, simple triple equal comparisons are done, not in-depth