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

Avoid re-rendering RoomList on room switch #1375

Merged
merged 1 commit into from
Sep 11, 2017
Merged

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Sep 11, 2017

Introduce a class that consumes updates from the RoomViewStore and
announces to listeners if the active room ID is now or is no longer
the room ID they specified. Naming suggestions welcome: it's
currently called ActiveRoomObserver. This basically re-introduces concepts from the ConstantTimeDispatcher branch.

Avoids passing the selectedRoomId down from MatrixChat all the way
through the LeftPanel / RoomList / RoomSubList to the RoomTiles.

Also introduce a CallPreview class that listens directly for
RoomViewStore changes as the call preview in the left panel needs
to know when the room changes, so this allows this component to
update without having to update the entire left panel.

Requires element-hq/element-web#5015

Introduce a class that consumes updates from the RoomViewStore and
announces to listeners if the active room ID is now or is no longer
the room ID they specified. Naming suggestions welcome: it's
currently called ActiveRoomObserver.

Avoids passing the selectedRoomId down from MatrixChat all the way
through the LeftPanel / RoomList / RoomSubList to the RoomTiles.

Also introduce a CallPreview class that listens directly for
RoomViewStore changes as the call preview in the left panel needs
to know when the room changes, so this allows this component to
update without having to update the entire left panel.
@ara4n
Copy link
Member

ara4n commented Sep 11, 2017

lgtm, although the fact that ActiveRoomObserver is not a generic Observer makes me feel very very sadpanda. it's not a blocker for merging it, but i can see this pattern being used all over the shop to save CPU (e.g. i'm sure MemberList suffers the same woes, especially if presence were turned on), and having the impl concretized into the ActiveRoom specific scenario feels Wrong.

Also, i'm assuming you've tested that the CallPreview persists correctly if you're on a 1:1 when switching between rooms (and when switching between preview and non-preview mode), as istr this was slightly subtle when I wrote it. It would suck if the preview gets ripped down and remounted every time you changed room or something.

@dbkr
Copy link
Member Author

dbkr commented Sep 11, 2017

Yeah - intention here is very much that if we introduce more of these, we can move the common functions into their own class.

And yep, CallPreview does the right thing in my testing, and stays nicely in the corner when switching between rooms other than the one the call is in (and also correctly goes away if the call gets hung up from the other end).

@dbkr dbkr merged commit 3c70b86 into develop Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants