Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Room List - Update the room list store on actions from the dispatcher #29397

Merged
merged 12 commits into from
Mar 3, 2025

Conversation

MidhunSureshR
Copy link
Member

@MidhunSureshR MidhunSureshR commented Mar 2, 2025

This PR modifies the new room list store so that it listens to actions on the dispatcher and re-inserts the necessary room(s) as necessary. Based on https://github.com/element-hq/element-web/blob/develop/src/stores/room-list/RoomListStore.ts#L183

@MidhunSureshR MidhunSureshR changed the base branch from develop to midhun/rls/room-list-vm-1 March 2, 2025 09:37
@MidhunSureshR MidhunSureshR force-pushed the midhun/rls/room-list-vm-1 branch from f9754ea to a7817e5 Compare March 2, 2025 11:06
@MidhunSureshR MidhunSureshR changed the title Update the room list store on actions from the dispatcher Room List - Update the room list store on actions from the dispatcher Mar 3, 2025
Base automatically changed from midhun/rls/room-list-vm-1 to develop March 3, 2025 11:25
- Make if/else more consistent
- Add comment on findAndAddRoom()
On a timeline action, we return early if payload.room is falsy.
So then why do we need to retry fetching the room?
I think this can be removed but will ask others if there's some
conext I'm missing.
Comment on lines 126 to 139
if (payload.event_type !== EventType.Direct) return;
const dmMap = payload.event.getContent();
for (const userId of Object.keys(dmMap)) {
const roomIds = dmMap[userId];
for (const roomId of roomIds) {
const room = this.matrixClient.getRoom(roomId);
if (!room) {
logger.warn(`${roomId} was found in DMs but the room is not in the store`);
continue;
}
this.addRoomAndEmit(room);
}
}
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fire LISTS_UPDATE_EVENT multiple times. Can we add the rooms to the skip list and after fire once the event?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in bab8d93

}
}

private addRoomAndEmit(room: Room): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tsdoc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3e32e2d

@MidhunSureshR MidhunSureshR enabled auto-merge March 3, 2025 15:00
@MidhunSureshR MidhunSureshR added this pull request to the merge queue Mar 3, 2025
Merged via the queue into develop with commit bf48100 Mar 3, 2025
32 checks passed
@MidhunSureshR MidhunSureshR deleted the midhun/rls/updates branch March 3, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants