Skip to content

Commit 6095b1b

Browse files
authored
Merge pull request #164 from part3-4team-Taskify/feature/Gnb
[Fix] CardDetailModal: 카드 수정 시 이미지 없으면 에러 발생 fix, 변경사항 있을 때만 새로고침되도록 변경
2 parents feb8fcc + 7161439 commit 6095b1b

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

src/components/modalDashboard/CardDetailModal.tsx

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,14 @@ export default function CardDetailPage({
7070

7171
setTimeout(() => {
7272
router.reload();
73-
}, 1500);
73+
}, 1700);
7474
},
7575
});
76-
const initialData = {
77-
title: card.title,
78-
description: card.description,
79-
dueDate: card.dueDate,
80-
tags: card.tags,
81-
assignee: card.assignee,
82-
};
8376

8477
const handleClose = () => {
8578
onClose();
86-
87-
const hasChanged =
88-
cardData.title !== initialData.title ||
89-
cardData.description !== initialData.description ||
90-
!isEqual(cardData.dueDate, initialData.dueDate) ||
91-
JSON.stringify(cardData.tags) !== JSON.stringify(initialData.tags) ||
92-
JSON.stringify(cardData.assignee) !==
93-
JSON.stringify(initialData.assignee);
94-
if (hasChanged) {
95-
router.reload(); // 수정된 게 있을 경우만 새로고침
96-
}
9779
};
80+
9881
const handleCommentSubmit = () => {
9982
if (!commentText.trim()) return;
10083
createCommentMutate({
@@ -210,10 +193,11 @@ export default function CardDetailPage({
210193
description: data.description,
211194
dueDate: data.deadline,
212195
tags: data.tags,
213-
imageUrl: data.image ?? "",
196+
imageUrl: data.image || undefined,
214197
});
215198

216199
setIsEditModalOpen(false);
200+
router.reload();
217201
}}
218202
initialData={{
219203
status: columnName,

0 commit comments

Comments
 (0)