Populate metadata for every restored chat pane

This commit is contained in:
2026-11-06 19:19:24 +00:00
parent 7d2e200407
commit 803a067edf
2 changed files with 12 additions and 2 deletions
+3 -2
View File
@@ -295,6 +295,7 @@ class _ChatScreenState extends State<ChatScreen> with _ChatScreenWorkspace {
void _adoptRows(List<JsonMap> rows) {
if (!mounted) return;
final selected = _selected;
final retained = _workspace.panes.map((pane) => pane.sessionId).toSet();
final next = <String, JsonMap>{};
for (final row in rows) {
final id = '${row['id'] ?? ''}';
@@ -303,7 +304,7 @@ class _ChatScreenState extends State<ChatScreen> with _ChatScreenWorkspace {
final previous = _listedRows[id];
_listedRows[id] = listed;
final opened = _openedSessions[id];
if (opened == null && id != selected) continue;
if (opened == null && id != selected && !retained.contains(id)) continue;
if (opened != null && chatJsonEquals(previous, listed)) continue;
final adopted = <String, dynamic>{...?opened, ...listed};
if (opened != null && opened.containsKey('running')) {
@@ -336,7 +337,7 @@ class _ChatScreenState extends State<ChatScreen> with _ChatScreenWorkspace {
/// The row to open for [id], with an accepted model folded in.
@override
JsonMap? _rowFor(String id) {
final row = _openedSessions[id];
final row = _openedSessions[id] ?? _listedRows[id];
final accepted = _acceptedModels[id];
if (row == null || accepted == null) return row;
return {