RoomList: improve performance (#32919)
* perf: add memo to room avatar view * perf: batch rlsV3 emit * perf: avoid to re-render the room list if the room list state and sections are same * perf: listen only message preview of the specific room * perf: avoid to re-render the room list item if the notification or the content is same * chore: replace useState and useEffect by useMemo in virtualized list * fix: listen to room name event in RoomAvatar * fix: room avatar re-render when room is low priority
This commit is contained in:
+11
-1
@@ -6,7 +6,16 @@
|
||||
*/
|
||||
|
||||
import { renderHook, waitFor } from "jest-matrix-react";
|
||||
import { JoinRule, type MatrixClient, type Room, RoomMember, User } from "matrix-js-sdk/src/matrix";
|
||||
import {
|
||||
JoinRule,
|
||||
type MatrixClient,
|
||||
MatrixEvent,
|
||||
type Room,
|
||||
RoomEvent,
|
||||
RoomMember,
|
||||
User,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { act } from "react";
|
||||
|
||||
import {
|
||||
AvatarBadgeDecoration,
|
||||
@@ -78,6 +87,7 @@ describe("RoomAvatarViewModel", () => {
|
||||
|
||||
// 4. With presence, public room, video room and low priority, low priority takes precedence
|
||||
room.tags[DefaultTagID.LowPriority] = {};
|
||||
act(() => room.emit(RoomEvent.Tags, new MatrixEvent(), room));
|
||||
rerender(room);
|
||||
expect(vm.current.badgeDecoration).toBe(AvatarBadgeDecoration.LowPriority);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user