From 88858945c580942fea8f55e0f0c071d41cd1b16e Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 12 Nov 2026 03:37:01 +0000 Subject: [PATCH] Route rail re-taps through destination reselection Ensure the navigation rail shares the destination re-selection hook used by the phone tab bar, so re-tapping Chat can reopen active chats on wide layouts. Add focused coverage and record the land-gate verification results. --- app/lib/shell/adaptive_shell.dart | 4 ++- app/notes/chat-tab-retap-open-active-chat.md | 27 ++++++++++++++++++ app/test/shell/destination_reselect_test.dart | 28 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/app/lib/shell/adaptive_shell.dart b/app/lib/shell/adaptive_shell.dart index 14e1fba3..ce831bf0 100644 --- a/app/lib/shell/adaptive_shell.dart +++ b/app/lib/shell/adaptive_shell.dart @@ -288,7 +288,9 @@ class _AdaptiveShellState extends State { destination, destinationDetails(destination).icon, ), - onSelected: _select, + // Every tab control shares the tap entry, so a rail + // re-tap reaches the re-select hook like the bar's. + onSelected: _tapDestination, padding: EdgeInsets.only( top: system.top, bottom: system.bottom, diff --git a/app/notes/chat-tab-retap-open-active-chat.md b/app/notes/chat-tab-retap-open-active-chat.md index ad5c2cc5..9594c63a 100644 --- a/app/notes/chat-tab-retap-open-active-chat.md +++ b/app/notes/chat-tab-retap-open-active-chat.md @@ -56,3 +56,30 @@ -> 10 passed, 0 failed (verdict named only these two paths). - `tool/analyze.sh` -> clean. - Not run: the other nine files from the earlier run; not rerun this visit. + +## Land-gate fix: rail re-tap reaches the re-select hook +- Cause: on a wide window (`showsNavigationRail`, width >= + `kNavigationRailMinWindowWidth`) the rail's `onSelected` was wired to `_select`, + so a re-tap of the shown Chat rail item never called `onDestinationReselected`. + The floating bar already used `_tapDestination`. +- Fix: `lib/shell/adaptive_shell.dart` passes `_tapDestination` to + `ShellNavigationRail`. Settings on the rail goes through the same entry; it has + no hook branch of its own, and `_reselectDestination` sends non-Chat tabs to + `_selectDestination`, so Settings behaves as before. +- Test: `test/shell/destination_reselect_test.dart` gains a phone-width case + (400x800, floating bar) so both nav widgets are covered. The existing 800px cases + exercise the rail. + +## Focused results (app/, memwatch, this visit) +- `test/shell/destination_reselect_test.dart test/application/chat_registration_test.dart` + -> 11 passed, 0 failed (verdict named only these two paths). +- Affected users of `AdaptiveShell` / the rail, run as one list of 17 files + (rail, floating bar, tab history, shortcuts, menu, pipelines_app_test, chat + wide/scroll back, chat open shortcut, chat control tab, terminal chat tab, + chat next chat, plus the two above) -> 69 passed, 0 failed. +- `test/application/tab_location_navigation_test.dart` -> 2 passed, 4 failed + ("Settings is retained...", "a delayed read merges...", "an explicit root URL...", + "Settings does not clear..."). The same 4 fail with the rail line reverted to + `_select`, and on untouched main (9999e091, temporary detached worktree, since + removed). Pre-existing; not caused by this change, not fixed here. +- `tool/analyze.sh` -> clean. diff --git a/app/test/shell/destination_reselect_test.dart b/app/test/shell/destination_reselect_test.dart index c46957ba..e6b47bf7 100644 --- a/app/test/shell/destination_reselect_test.dart +++ b/app/test/shell/destination_reselect_test.dart @@ -33,6 +33,34 @@ void main() { expect(selected, isEmpty); }); + testWidgets('a phone tab bar re-tap of the shown tab re-selects it', ( + tester, + ) async { + tester.view.physicalSize = const Size(400, 800); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); + final selected = []; + final reselected = []; + await tester.pumpWidget( + MaterialApp( + home: AdaptiveShell( + destinationBodies: bodies(), + destination: AppDestination.chat, + onDestinationSelected: selected.add, + onDestinationReselected: reselected.add, + ), + ), + ); + await tester.pump(); + + await tester.tap(find.byKey(const ValueKey('shell.destination.chat'))); + await tester.pump(); + + expect(reselected, [AppDestination.chat]); + expect(selected, isEmpty); + }); + testWidgets('tapping another tab selects it, not a re-select', ( tester, ) async {