ViewPager: avoid redundant room list action handling

In particular bad where "Open at recent messages" would open the room as
many times as room lists are alive in the view pager.

Change-Id: I58fb2df012e56ce0b6afb984f48c74b7c3e146db
This commit is contained in:
SpiritCroc 2021-12-24 09:23:58 +01:00
parent e78ad54850
commit e2e068f549

View file

@ -132,7 +132,12 @@ class RoomListFragment @Inject constructor(
sharedActionViewModel
.stream()
.onEach { handleQuickActions(it) }
.onEach {
// We might have multiple RoomListFragments, we only want to handle the action once though
if (isResumed || roomListParams.explicitSpaceId == SPACE_ID_FOLLOW_APP) {
handleQuickActions(it)
}
}
.launchIn(viewLifecycleOwner.lifecycleScope)
roomListViewModel.onEach(RoomListViewState::roomMembershipChanges) { ms ->