-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
8e30510
to
c2079e1
Compare
f9754ea
to
a7817e5
Compare
23f158a
to
35a9cbe
Compare
534e3e1
to
9f0f782
Compare
- 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.
9cd1f3f
to
9465811
Compare
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tsdoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3e32e2d
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