Files
pipelines/app/notes/chat-tab-retap-open-active-chat.md
T
alan 3c2c114d7f Open active chat when Chat is reselected
Route destination re-selections through the adaptive shell so Chat can restore its retained workspace and focus the composer. Add shell and phone coverage plus implementation notes for the empty-list behavior and verification limits.
2026-11-12 02:08:09 +00:00

3.2 KiB

Chat tab re-tap opens the active chat

Change

  • lib/shell/adaptive_shell.dart: new onDestinationReselected hook on AdaptiveShell. Every tab control calls _tapDestination; a tap on the destination already shown goes to the hook (when given), any other tap selects as before.
  • lib/application/pipelines_app.dart: the Chat re-tap decision (chatRouteForRetap with the retained workspace route) moved from _selectDestination into _reselectDestination, passed as onDestinationReselected. Other tabs keep _selectDestination's behaviour.
  • Tests: test/shell/destination_reselect_test.dart (new, 3 cases) and test/application/chat_registration_test.dart (one new phone case: list -> re-tap Chat -> active chat shows).

Focused results (app/, memwatch)

  • Baseline before edits: chat_registration_test, app_route_test, destination_shortcuts_test -> 21 passed, 0 failed.
  • After edits, 11 files: destination_reselect_test, chat_registration_test, app_route_test, tab_location_navigation_test, pipelines_app_test, tab_history_back_test, floating_tab_bar_test, chat_control_tab_test, terminal_chat_tab_test, chat_wide_back_test, chat_scroll_back_test -> 55 passed, 0 failed (one earlier run failed on my own test's second phone re-tap, which is unreachable; that step was removed, not the expectation).
  • tool/analyze.sh -> clean.

States covered by tests

  • Phone: list (chat detail Back'd) -> re-tap Chat -> /chat/a with the thread.
  • No open chats / removed chat: stays on the list (existing case in chat_registration_test, still passing).
  • Shell: re-tap calls the hook and not selection; other tab selects; with no hook a re-tap is a plain selection.

Limitations

  • Not browser- or device-verified (no capture here, per stage rules).
  • On a phone the open chat page covers the tab bar, so the "already showing" re-tap is not reachable there; it is not tested.
  • A future NavigationRail or phone bottom bar must call _tapDestination (the shell's tab entry) to get the same re-select behaviour.

Review fix: composer focus on re-tap from the list

  • lib/application/pipelines_app.dart (_reselectDestination): when the Chat re-tap reopens the retained chat from the list, its composer now takes focus (_focusOpenChatComposer, the same request Ctrl+K makes), after goTo, as _openChat does. A re-tap while a chat is already showing requests nothing.
  • Test: test/application/chat_registration_test.dart, new case "mobile Chats retap from the list focuses the reopened chat composer" (phone size, list after Back -> re-tap Chat -> chat-composer-a EditableText has focus). The focus request is not platform-specific; a wide layout has no Back control that hides the workspace, so the case is run at phone size.
  • Mutation check: with the focus call disabled the new case fails (6 passed, 1 failed); restored, the file passes.

Focused results after the fix (app/, memwatch)

  • test/application/chat_registration_test.dart test/shell/destination_reselect_test.dart -> 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.