mirror of
https://github.com/vector-im/element-web.git
synced 2026-03-01 19:41:15 +01:00
perf(room list): clear room list item vm only when changing space
Clearing all the item vms at every room list change is causing massive re-render of all the room list items. References to the vms are already removed when out of view (see RoomListViewMode.updateVisibleRooms) and handled by GC.
This commit is contained in:
parent
3fb99fee26
commit
24dc90cc09
@ -133,9 +133,6 @@ export class RoomListViewViewModel
|
||||
// Update roomsMap immediately before clearing VMs
|
||||
this.updateRoomsMap(this.roomsResult);
|
||||
|
||||
// Clear view models since room list changed
|
||||
this.clearViewModels();
|
||||
|
||||
this.updateRoomListData();
|
||||
};
|
||||
|
||||
@ -291,11 +288,13 @@ export class RoomListViewViewModel
|
||||
|
||||
const newSpaceId = this.roomsResult.spaceId;
|
||||
|
||||
// Clear view models since room list structure changed
|
||||
this.clearViewModels();
|
||||
|
||||
// Detect space change
|
||||
if (oldSpaceId !== newSpaceId) {
|
||||
// Clear view models when the space changes
|
||||
// We only want to do this on space changes, not on regular list updates, to preserve view models when possible
|
||||
// The view models are disposed when scrolling out of view (handled by updateVisibleRooms)
|
||||
this.clearViewModels();
|
||||
|
||||
// Space changed - get the last selected room for the new space to prevent flicker
|
||||
const lastSelectedRoom = SpaceStore.instance.getLastSelectedRoomIdForSpace(newSpaceId);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user