Skip to content

Commit 3e38daa

Browse files
authored
Fix bug with adding assigneeRdsInfo to tasks (#1136)
* wait for the promises to fullfil before adding assigneeRdsInfo in tasks * resolve promises inside fetchTasks model
1 parent 60aa74e commit 3e38daa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

models/tasks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const fetchTasks = async () => {
7474
const tasks = buildTasks(tasksSnapshot);
7575
const promises = tasks.map(async (task) => fromFirestoreData(task));
7676
const updatedTasks = await Promise.all(promises);
77-
const taskList = updatedTasks.map(async (task) => {
77+
const taskPromises = updatedTasks.map(async (task) => {
7878
task.status = TASK_STATUS[task.status.toUpperCase()] || task.status;
7979
const taskId = task.id;
8080
const dependencySnapshot = await dependencyModel.where("taskId", "==", taskId).get();
@@ -85,6 +85,7 @@ const fetchTasks = async () => {
8585
});
8686
return task;
8787
});
88+
const taskList = await Promise.all(taskPromises);
8889
return taskList;
8990
} catch (err) {
9091
logger.error("error getting tasks", err);

0 commit comments

Comments
 (0)