diff --git a/mobile/lib/features/activity/activity_page.dart b/mobile/lib/features/activity/activity_page.dart index d60b97984..5a3a7bf04 100644 --- a/mobile/lib/features/activity/activity_page.dart +++ b/mobile/lib/features/activity/activity_page.dart @@ -442,6 +442,7 @@ class _WideActivityDetail extends HookWidget { final navigatorKey = useMemoized(GlobalKey.new, [item!.id]); return NavigatorPopHandler( + key: ValueKey('wide-activity-detail-${item!.id}'), onPopWithResult: (_) => navigatorKey.currentState?.maybePop(), child: Navigator( key: navigatorKey, diff --git a/mobile/lib/features/channels/channels_provider.dart b/mobile/lib/features/channels/channels_provider.dart index c0525a0b2..bc6144fb4 100644 --- a/mobile/lib/features/channels/channels_provider.dart +++ b/mobile/lib/features/channels/channels_provider.dart @@ -95,8 +95,9 @@ class ChannelsNotifier extends AsyncNotifier> { }); if (sessionState.status != SessionStatus.connected) { - // Keep the prior community's cache visible until the new relay connects. - if (_hasLoaded) return state.value ?? const []; + // Preserve the prior community's cache as previous AsyncValue data while + // the new relay connects, but remain loading so consumers cannot expose + // stale channels as interactive rows in the new community. await connected.future; } diff --git a/mobile/lib/features/home/home_page/wide_navigation.dart b/mobile/lib/features/home/home_page/wide_navigation.dart index 91b29a216..0c8e4027e 100644 --- a/mobile/lib/features/home/home_page/wide_navigation.dart +++ b/mobile/lib/features/home/home_page/wide_navigation.dart @@ -756,6 +756,7 @@ class _WideChannelContent extends HookWidget { channel.id, ]); return NavigatorPopHandler( + key: ValueKey('wide-channel-detail-${channel.id}'), onPopWithResult: (_) => navigatorKey.currentState?.maybePop(), child: Navigator( key: navigatorKey, diff --git a/mobile/test/features/channels/channels_provider_test.dart b/mobile/test/features/channels/channels_provider_test.dart index c128b9be5..8058c6813 100644 --- a/mobile/test/features/channels/channels_provider_test.dart +++ b/mobile/test/features/channels/channels_provider_test.dart @@ -457,11 +457,13 @@ void main() { .read(relayConfigProvider.notifier) .update(baseUrl: 'https://new-community.example'); await Future.delayed(Duration.zero); + expect(container.read(channelsProvider).isLoading, isTrue); expect(container.read(channelsProvider).value?.single.name, 'general'); session.setStatus(SessionStatus.connected); await Future.delayed(Duration.zero); + expect(container.read(channelsProvider).isLoading, isFalse); expect(container.read(channelsProvider).value?.single.name, 'random'); }, );