Populate metadata for every restored chat pane
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -79,6 +79,15 @@ void main() {
|
||||
expect(controller.panes.map((pane) => pane.sessionId), ['a', 'b']);
|
||||
expect(controller.activePane?.sessionId, 'b');
|
||||
if (width > 1000) {
|
||||
for (final pane in controller.panes) {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(ValueKey('chat-pane-detail-${pane.id}')),
|
||||
matching: find.text('Chat ${pane.sessionId}'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
expect(
|
||||
tester
|
||||
.widget<ChatSidebarButton>(find.byType(ChatSidebarButton).first)
|
||||
|
||||
Reference in New Issue
Block a user