Skip to content

Commit bc43a52

Browse files
committed
fix: 선택한 날짜의 Todo 가 선택되지 않는 문제 해결
ticket: https://www.notion.so/29abf989e8858058b247c2bf08728a2b?source=copy_link
1 parent d56ad39 commit bc43a52

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/feature/todo/weeklyTodoList/components/AddTodoButton.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ import { Z_INDEX } from '@/shared/lib/z-index';
1515
interface AddTodoButtonProps {
1616
goal: Goal;
1717
selectedPlanId: string;
18-
selectedDate: Date | null;
18+
selectedDate: Date;
1919
onTodoAdded?: (addedDate: Date) => void;
2020
}
2121

2222
interface AddTodoFormData {
2323
content: string;
24-
selectedDate: Date | undefined;
24+
selectedDate: Date;
2525
}
2626

27-
export const AddTodoButton = ({ goal, selectedPlanId, selectedDate, onTodoAdded }: AddTodoButtonProps) => {
27+
export const AddTodoButton = ({ goal, selectedPlanId, selectedDate = new Date(), onTodoAdded }: AddTodoButtonProps) => {
2828
const [open, setOpen] = useState(false);
2929
const { showToast } = useToast();
3030
const { trackButtonClick } = useGTMActions();
@@ -43,7 +43,7 @@ export const AddTodoButton = ({ goal, selectedPlanId, selectedDate, onTodoAdded
4343
mode: 'onChange',
4444
defaultValues: {
4545
content: '',
46-
selectedDate: selectedDate || undefined,
46+
selectedDate: selectedDate,
4747
},
4848
});
4949

@@ -110,6 +110,7 @@ export const AddTodoButton = ({ goal, selectedPlanId, selectedDate, onTodoAdded
110110
buttonName: GTM_BUTTON_NAME.ADD_TODO_SHEET,
111111
});
112112
setOpen(true);
113+
setValue('selectedDate', selectedDate, { shouldValidate: true });
113114
};
114115

115116
const handleOpenChange = (newOpen: boolean) => {

0 commit comments

Comments
 (0)