You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user