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:
@@ -20,7 +20,6 @@ import { RoomNotificationState } from "../../../src/stores/notifications/RoomNot
|
||||
import { RoomNotificationStateStore } from "../../../src/stores/notifications/RoomNotificationStateStore";
|
||||
import { NotificationStateEvents } from "../../../src/stores/notifications/NotificationState";
|
||||
import { type MessagePreview, MessagePreviewStore } from "../../../src/stores/message-preview";
|
||||
import { UPDATE_EVENT } from "../../../src/stores/AsyncStore";
|
||||
import SettingsStore from "../../../src/settings/SettingsStore";
|
||||
import DMRoomMap from "../../../src/utils/DMRoomMap";
|
||||
import { DefaultTagID } from "../../../src/stores/room-list-v3/skip-list/tag";
|
||||
@@ -200,7 +199,7 @@ describe("RoomListItemViewModel", () => {
|
||||
text: "Updated message",
|
||||
} as MessagePreview);
|
||||
|
||||
MessagePreviewStore.instance.emit(UPDATE_EVENT);
|
||||
MessagePreviewStore.instance.emit(MessagePreviewStore.getPreviewChangedEventName(room));
|
||||
|
||||
await flushPromises();
|
||||
expect(viewModel.getSnapshot().messagePreview).toBe("Updated message");
|
||||
|
||||
Reference in New Issue
Block a user