Skip to content

Commit

Permalink
fix: 외부 편집 사항이 내 편집사항을 덮어쓰는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
PMtHk committed Dec 4, 2024
1 parent ada9649 commit 22eb74f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export function KanbanBoard({ projectId }: KanbanBoardProps) {
} = useDragAndDrop(onDrop);

const handleTitleChange = (taskId: number, newTitle: string) => {
updateTaskTitle(taskId, newTitle);

const task = findTask(sections, taskId);
if (!task) return;

Expand Down Expand Up @@ -96,8 +98,6 @@ export function KanbanBoard({ projectId }: KanbanBoardProps) {
} else if (diff.content.length > 0) {
updateTitleMutate(insertPayload);
}

updateTaskTitle(taskId, newTitle);
};

return (
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/features/project/board/useBoardStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ const handleTitleInserted = (sections: TSection[], event: TaskEvent): TSection[]
const task = section.tasks.find((t) => t.id === event.task.id);

const title = task?.title ?? '';
const { position, content, length } = event.task.title!;
const newTitle = title.slice(0, position) + content + title.slice(position + length);
const { position, content } = event.task.title!;
const newTitle = title.slice(0, position) + content + title.slice(position);

return {
...section,
Expand All @@ -223,7 +223,7 @@ const handleTitleInserted = (sections: TSection[], event: TaskEvent): TSection[]
});
};

const handleTitleDeleted = (sections: TSection[], event: TaskEvent): TSection[] => {
export const handleTitleDeleted = (sections: TSection[], event: TaskEvent): TSection[] => {
return sections.map((section) => {
const task = section.tasks.find((t) => t.id === event.task.id);

Expand Down

0 comments on commit 22eb74f

Please sign in to comment.