diff --git a/src/components/views/rooms/RoomSublist.tsx b/src/components/views/rooms/RoomSublist.tsx index 54766c58df..c6730e5a65 100644 --- a/src/components/views/rooms/RoomSublist.tsx +++ b/src/components/views/rooms/RoomSublist.tsx @@ -47,7 +47,7 @@ import { polyfillTouchEvent } from "../../../@types/polyfill"; import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore"; import RoomListLayoutStore from "../../../stores/room-list/RoomListLayoutStore"; import { arrayHasOrderChange } from "../../../utils/arrays"; -import { objectExcluding, objectHasValueChange } from "../../../utils/objects"; +import { objectExcluding, objectHasDiff } from "../../../utils/objects"; import TemporaryTile from "./TemporaryTile"; import { ListNotificationState } from "../../../stores/notifications/ListNotificationState"; @@ -181,7 +181,7 @@ export default class RoomSublist extends React.Component { } public shouldComponentUpdate(nextProps: Readonly, nextState: Readonly): boolean { - if (objectHasValueChange(this.props, nextProps)) { + if (objectHasDiff(this.props, nextProps)) { // Something we don't care to optimize has updated, so update. return true; } @@ -189,7 +189,7 @@ export default class RoomSublist extends React.Component { // Do the same check used on props for state, without the rooms we're going to no-op const prevStateNoRooms = objectExcluding(this.state, ['rooms']); const nextStateNoRooms = objectExcluding(nextState, ['rooms']); - if (objectHasValueChange(prevStateNoRooms, nextStateNoRooms)) { + if (objectHasDiff(prevStateNoRooms, nextStateNoRooms)) { return true; } diff --git a/src/utils/objects.ts b/src/utils/objects.ts index 9dcc41ecd2..77e5f59418 100644 --- a/src/utils/objects.ts +++ b/src/utils/objects.ts @@ -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