mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-16 03:34:28 +01:00
Fixed bug where task list did not update when creating new task
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user