mirror of https://github.com/vector-im/riot-web
Merge pull request #5681 from matrix-org/jryans/fix-object-diff
Fix object diffing when objects have different keyspull/21833/head
commit
1b82a593f3
|
@ -89,6 +89,7 @@ export function objectHasDiff<O extends {}>(a: O, b: O): boolean {
|
||||||
if (a === b) return false;
|
if (a === b) return false;
|
||||||
const aKeys = Object.keys(a);
|
const aKeys = Object.keys(a);
|
||||||
const bKeys = Object.keys(b);
|
const bKeys = Object.keys(b);
|
||||||
|
if (aKeys.length !== bKeys.length) return true;
|
||||||
const possibleChanges = arrayUnion(aKeys, bKeys);
|
const possibleChanges = arrayUnion(aKeys, bKeys);
|
||||||
// if the amalgamation of both sets of keys has the a different length to the inputs then there must be a change
|
// if the amalgamation of both sets of keys has the a different length to the inputs then there must be a change
|
||||||
if (possibleChanges.length !== aKeys.length) return true;
|
if (possibleChanges.length !== aKeys.length) return true;
|
||||||
|
|
Loading…
Reference in New Issue