From c78d6cdf500d9be3af5bf512f9c57fe0a50e2d1f Mon Sep 17 00:00:00 2001 From: kenny lopez Date: Mon, 3 Aug 2026 18:33:52 +0100 Subject: [PATCH] fix wide inbox channel leave handling Signed-off-by: kenny lopez --- .../lib/features/activity/activity_page.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mobile/lib/features/activity/activity_page.dart b/mobile/lib/features/activity/activity_page.dart index 535775019..92e91b8cc 100644 --- a/mobile/lib/features/activity/activity_page.dart +++ b/mobile/lib/features/activity/activity_page.dart @@ -72,6 +72,10 @@ class ActivityPage extends HookConsumerWidget { final filter = useState(InboxFilter.all); final unreadOnly = useState(false); final selectedItemId = useState(null); + // A channel can be left from the persistent detail navigator before the + // refreshed Activity feed arrives. Hide its rows immediately so the + // sidebar cannot retain a detail for a channel that is no longer joined. + final leftChannelIds = useState>({}); // Retain the event selected before its row is marked read. A grouped row // otherwise recomputes its deep link after the read marker changes and // opens the latest event instead of the oldest unread one the user chose. @@ -108,7 +112,8 @@ class ActivityPage extends HookConsumerWidget { final visibleItems = [ for (final item in allItems) - if (matchesInboxFilter(item, filter.value) && + if (!leftChannelIds.value.contains(item.item.channelId) && + matchesInboxFilter(item, filter.value) && (!unreadOnly.value || !isDone(item))) item, ]; @@ -288,6 +293,14 @@ class ActivityPage extends HookConsumerWidget { ]); } + void handleChannelLeft(String channelId) { + leftChannelIds.value = {...leftChannelIds.value, channelId}; + selectedItemId.value = null; + selectedItemTarget.value = null; + selectedItemForDetail.value = null; + unawaited(refresh()); + } + final Widget body; if (filter.value == InboxFilter.reminders) { body = _RemindersList(onOpen: openReminder, onRefresh: refresh); @@ -431,6 +444,7 @@ class ActivityPage extends HookConsumerWidget { channel: selectedChannel, initialMessageId: selectedTarget?.id, initialThreadRootId: selectedThread, + onChannelLeft: () => handleChannelLeft(selectedChannel!.id), ), ), ], @@ -448,12 +462,14 @@ class _WideActivityDetail extends HookWidget { final Channel? channel; final String? initialMessageId; final String? initialThreadRootId; + final VoidCallback onChannelLeft; const _WideActivityDetail({ required this.item, required this.channel, required this.initialMessageId, required this.initialThreadRootId, + required this.onChannelLeft, }); @override @@ -475,6 +491,7 @@ class _WideActivityDetail extends HookWidget { channel: channel!, initialMessageId: initialMessageId, initialThreadRootId: initialThreadRootId, + onChannelLeft: onChannelLeft, ), ), ),