Open selected chats from search

Re-apply explicit chat routes after workspace restoration and repeated route notifications so search results and chat notifications open the requested session. Add regression coverage for route, registration, and workspace restore behavior.
This commit is contained in:
2026-11-13 15:58:16 +00:00
parent eeb07e5645
commit ec3c1e4c6a
8 changed files with 241 additions and 12 deletions
@@ -10,6 +10,7 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
bool _chatOwnsKeyboard();
JsonMap? _rowFor(String id);
void _back();
void _openRouted(String id);
bool get _pageOpen;
Widget _thread(ChatWorkspacePane pane);
@@ -185,6 +186,17 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
_usedWorkspace = true;
_workspaceVisible = _workspace.paneCount > 0;
});
// A route can arrive while the local workspace is being restored.
// Re-apply it after restore so the saved active pane cannot overwrite
// an explicit notification or Search selection.
final id = widget.initialSessionId;
if (id != null &&
id.isNotEmpty &&
_workspace.activePane?.sessionId != id) {
_workspaceVisible = true;
_publishedWorkspaceSession = id;
_openRouted(id);
}
_publishWorkspaceRoute();
},
);