Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Fixed bug where task list did not update when creating new task

hunteraraujoc739e049c3e4
diff --git a/frontend/lib/viewmodels/task_viewmodel.dart b/frontend/lib/viewmodels/task_viewmodel.dart
index d00934f14b..7b0bbc72e9 100644
--- a/frontend/lib/viewmodels/task_viewmodel.dart
+++ b/frontend/lib/viewmodels/task_viewmodel.dart
@@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:auto_gpt_flutter_client/models/task.dart';
-import 'package:auto_gpt_flutter_client/models/task_response.dart';
import 'package:auto_gpt_flutter_client/models/test_suite.dart';
import 'package:flutter/foundation.dart';
import 'package:collection/collection.dart';
@@ -34,9 +33,10 @@ class TaskViewModel with ChangeNotifier {
final newTaskObject =
Task(id: createdTask['task_id'], title: createdTask['input']);
- // Update local tasks list and notify listeners
- _tasks.add(newTaskObject);
- notifyListeners();
+ fetchAndCombineData();
+
+ final taskId = newTaskObject.id;
+ print("Task $taskId created successfully!");
return newTaskObject.id; // Return the ID of the new task
}
diff --git a/frontend/lib/views/chat/chat_view.dart b/frontend/lib/views/chat/chat_view.dart
index 34517d0b93..a03cb68270 100644
--- a/frontend/lib/views/chat/chat_view.dart
+++ b/frontend/lib/views/chat/chat_view.dart
@@ -38,7 +38,7 @@ class _ChatViewState extends State<ChatView> {
}
});
- // Schedule the fetchTasks call for after the initial build
+ // Schedule the fetchChatsForTask call for after the initial build
WidgetsBinding.instance.addPostFrameCallback((_) {
widget.viewModel.fetchChatsForTask();
});