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.
This commit is contained in:
2026-11-12 02:08:09 +00:00
parent 2330f50268
commit 3c2c114d7f
5 changed files with 279 additions and 12 deletions
+21 -11
View File
@@ -697,20 +697,29 @@ class _PipelinesAppState extends State<PipelinesApp>
}
void _selectDestination(AppDestination destination) {
final current = tabForRoute(_delegate.route);
final last = _tabRoutes[destination];
if (destination == AppDestination.chat && current == destination) {
final reopened = chatRouteForRetap(
_delegate.shellRoute,
_chatWorkspaceRoute,
isValidSession: (id) =>
_availableChatSessionIds == null ||
_availableChatSessionIds!.contains(id),
);
_delegate.goTo(reopened ?? _routeOf(destination));
_delegate.goTo(last ?? _routeOf(destination));
}
/// A tap on the destination already shown. Chat reopens its retained
/// workspace when the list is showing; other tabs select as before.
void _reselectDestination(AppDestination destination) {
if (destination != AppDestination.chat) {
_selectDestination(destination);
return;
}
_delegate.goTo(last ?? _routeOf(destination));
final onList = _delegate.shellRoute.chatSessionId == null;
final reopened = chatRouteForRetap(
_delegate.shellRoute,
_chatWorkspaceRoute,
isValidSession: (id) =>
_availableChatSessionIds == null ||
_availableChatSessionIds!.contains(id),
);
_delegate.goTo(reopened ?? _routeOf(destination));
// From the list, the reopened chat's composer takes focus, as Ctrl+K does.
// A chat already showing keeps its focus behaviour.
if (onList && reopened != null) _focusOpenChatComposer();
}
void _routeChanged() {
@@ -832,6 +841,7 @@ class _PipelinesAppState extends State<PipelinesApp>
runningRunCount: counts.running,
destination: _destinationOf(route.kind),
onDestinationSelected: _selectDestination,
onDestinationReselected: _reselectDestination,
onOpenChat: _focusOpenChatComposer,
onClosePage: () => _delegate.goTo(
_bodyRoutes[AppDestination.pipelines] ?? AppRoute.pipelines,