diff --git a/app/lib/application/pipelines_app.dart b/app/lib/application/pipelines_app.dart index 69530ce3..a5463d10 100644 --- a/app/lib/application/pipelines_app.dart +++ b/app/lib/application/pipelines_app.dart @@ -247,8 +247,8 @@ class _PipelinesAppState extends State builder: _buildShell, ); _delegate.addListener(_routeChanged); - _tabRoutes[_destinationOf(_delegate.shellRoute.kind)] = - _delegate.shellRoute; + // Seed retained destinations for deep links as well as later navigation. + _routeChanged(); _chatQuestionNotices = ChatQuestionNotices( gateway: _session.gateway, canNotify: () => _notifications.canNotify, diff --git a/app/notes/chat-retap.md b/app/notes/chat-retap.md index 91040b6b..489df4b2 100644 --- a/app/notes/chat-retap.md +++ b/app/notes/chat-retap.md @@ -33,3 +33,8 @@ The session-list refresh test answers the cached thread's outstanding network reads before refreshing, matching the client's serialized request protocol. Focused follow-up: 18 tests passed (`/tmp/memwatch/out.0cayzm`); no new product implementation changes were needed for these acceptance cases. + +Boot deep links now seed the same retained route as later selections. A full-app +regression opens `/chat/a` directly, folds from wide to phone, goes Back and +retaps Chats; the conversation and original draft return. Six application +chat-registration tests pass (`/tmp/memwatch/out.hPT6re`). diff --git a/app/test/application/chat_registration_test.dart b/app/test/application/chat_registration_test.dart index bc86ec3b..07d5992e 100644 --- a/app/test/application/chat_registration_test.dart +++ b/app/test/application/chat_registration_test.dart @@ -658,4 +658,52 @@ void main() { expect(tester.takeException(), isNull); }, ); + testWidgets('Chats retap restores a boot deep link after folding and Back', ( + tester, + ) async { + SharedPreferences.setMockInitialValues({}); + tester.view.physicalSize = const Size(1000, 1000); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final channel = FakeChannel()..readyCompleter.complete(); + final client = PipelinesClient(channelFactory: (_) => channel); + final provider = PlatformRouteInformationProvider( + initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/a')), + ); + addTearDown(provider.dispose); + addTearDown(client.dispose); + await tester.pumpWidget( + PipelinesApp( + server: webServer(), + client: client, + cupertino: false, + routeInformationProvider: provider, + ), + ); + await tester.pump(); + await replyChatSessions(tester, channel, ['a']); + await replyChatHistory(tester, channel, subscribeIndex: 0, historyIndex: 0); + await tester.pumpAndSettle(); + await tester.enterText( + find.byKey(const Key('chat-composer-field')), + 'deep link draft', + ); + tester.view.physicalSize = const Size(560, 1000); + await tester.pumpAndSettle(); + await tester.tap(find.byTooltip('Back').hitTestable()); + await tester.pumpAndSettle(); + expect(provider.value.uri.path, '/chat'); + await tester.tap(find.byKey(const ValueKey('shell.destination.chat'))); + await tester.pumpAndSettle(); + expect(provider.value.uri.path, '/chat/a'); + expect(find.byType(ChatThreadView), findsOneWidget); + expect( + tester + .widget(find.byKey(const Key('chat-composer-field'))) + .controller! + .text, + 'deep link draft', + ); + expect(tester.takeException(), isNull); + }); }