Skip to content

Commit c5e8f2f

Browse files
committed
fix(ProjectTasksDataGrid): improve task ID handling and default status assignment
1 parent 3217f3e commit c5e8f2f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/tables/ProjectTasksDataGrid.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function ProjectTasksDataGrid({ projectId, onRowClick, onAddClick, onFetchComple
5454
}
5555

5656
const transformedTasks: Task[] = (fetchedTasksArray as TaskResponse[]).map((task: TaskResponse) => {
57-
const taskId = task._id || (task as { id?: string })?.id || '';
57+
const taskId = (task as { id?: string })?.id || '';
5858

5959
// Handle assignedTo
6060
let assignedToArray: string[] = [];
@@ -74,15 +74,15 @@ function ProjectTasksDataGrid({ projectId, onRowClick, onAddClick, onFetchComple
7474
title: task.title,
7575
description: task.description,
7676
priority: task.priority,
77-
status: task.status,
77+
status: (task as { status?: string }).status || 'To Do',
7878
startDate: task.startDate,
7979
endDate: task.endDate,
8080
createdBy: task.createdBy,
8181
createdAt: task.createdAt,
82-
comments: task.comments.map(c => ({
82+
comments: (task.comments || []).map(c => ({
8383
authorId: c.authorId,
8484
user: c.authorId,
85-
text: c.text || c.content || undefined,
85+
text: c.content || undefined,
8686
content: c.content || undefined,
8787
createdAt: c.createdAt
8888
}))

0 commit comments

Comments
 (0)