Skip to content

Commit

Permalink
Refactor: #148 불필요한 연산 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed Sep 24, 2024
1 parent 9aae7df commit a546817
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/hooks/query/useTaskQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ import type { Task, TaskCreationForm, TaskListWithStatus, TaskOrder } from '@/ty
import type { Project } from '@/types/ProjectType';

function getTaskNameList(taskList: TaskListWithStatus[], excludedTaskName?: Task['name']) {
const taskNameList =
taskList.length > 0
? taskList
.map((statusTask) => statusTask.tasks)
.flat()
.map((task) => task.name)
: [];
const taskNameList = taskList
.map((statusTask) => statusTask.tasks)
.flat()
.map((task) => task.name);

return excludedTaskName ? taskNameList.filter((taskName) => taskName !== excludedTaskName) : taskNameList;
}
Expand Down

0 comments on commit a546817

Please sign in to comment.