From e2e068f549e046b849e82492144446282d87e94c Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Fri, 24 Dec 2021 09:23:58 +0100 Subject: [PATCH] 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 --- .../vector/app/features/home/room/list/RoomListFragment.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt index d961f41904..3f7fba8b3b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt @@ -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 ->