From 41a251a481ce1c59f61bdf8ef16bf1035fc77fa5 Mon Sep 17 00:00:00 2001 From: Eunseo Sim <55528304+simeunseo@users.noreply.github.com> Date: Tue, 9 Jul 2024 02:30:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Context=20=EC=B4=88=EA=B8=B0=EA=B0=92=20?= =?UTF-8?q?undefined=20->=20null=EB=A1=9C=20=EB=B0=94=EA=BE=B8=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OverallSchedule/components/OverallScheduleTable.tsx | 2 +- src/pages/OverallSchedule/contexts/useClickContext.ts | 6 +++--- .../selectSchedule/components/SelectScheduleTable.tsx | 2 +- .../components/selectTimeSlot/hooks/useSlotSelection.ts | 8 ++++---- .../selectSchedule/contexts/useScheduleStepContext.ts | 2 +- src/pages/selectSchedule/contexts/useSelectContext.ts | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pages/OverallSchedule/components/OverallScheduleTable.tsx b/src/pages/OverallSchedule/components/OverallScheduleTable.tsx index 1553de8d..6d862223 100644 --- a/src/pages/OverallSchedule/components/OverallScheduleTable.tsx +++ b/src/pages/OverallSchedule/components/OverallScheduleTable.tsx @@ -21,7 +21,7 @@ function OverallScheduleTable({ availableDates, dataOverallSchedule, }: OverallScheduleTableProps) { - const [clickedSlot, setClickedSlot] = useState(undefined); + const [clickedSlot, setClickedSlot] = useState(null); const [clickedUserNames, setClickedUserNames] = useState([]); const getAvailableTimesPerDate = ( diff --git a/src/pages/OverallSchedule/contexts/useClickContext.ts b/src/pages/OverallSchedule/contexts/useClickContext.ts index 4723cb90..676990fa 100644 --- a/src/pages/OverallSchedule/contexts/useClickContext.ts +++ b/src/pages/OverallSchedule/contexts/useClickContext.ts @@ -1,15 +1,15 @@ import { Dispatch, SetStateAction, createContext, useContext } from 'react'; interface ClickContextType { - clickedSlot: string | undefined; + clickedSlot: string | null; setClickedSlot: Dispatch>; clickedUserNames: string[]; setClickedUserNames: Dispatch>; } export const ClickContext = createContext({ - clickedSlot: undefined, - setClickedSlot: () => undefined, + clickedSlot: null, + setClickedSlot: () => null, clickedUserNames: [], setClickedUserNames: () => [], }); diff --git a/src/pages/selectSchedule/components/SelectScheduleTable.tsx b/src/pages/selectSchedule/components/SelectScheduleTable.tsx index 4134e8bc..75f39dae 100644 --- a/src/pages/selectSchedule/components/SelectScheduleTable.tsx +++ b/src/pages/selectSchedule/components/SelectScheduleTable.tsx @@ -13,7 +13,7 @@ import { SelectContext, SelectedSlotType } from '../contexts/useSelectContext'; import { StepSlotsType, StepbottomItemsType } from '../types'; function SelectScheduleTable({ timeSlots, availableDates }: TimetableStructure) { - const [startSlot, setStartSlot] = useState(undefined); + const [startSlot, setStartSlot] = useState(null); const [selectedSlots, setSelectedSlots] = useState({}); const { scheduleStep } = useScheduleStepContext(); diff --git a/src/pages/selectSchedule/components/selectTimeSlot/hooks/useSlotSelection.ts b/src/pages/selectSchedule/components/selectTimeSlot/hooks/useSlotSelection.ts index 1bf8c221..bcbad5a1 100644 --- a/src/pages/selectSchedule/components/selectTimeSlot/hooks/useSlotSelection.ts +++ b/src/pages/selectSchedule/components/selectTimeSlot/hooks/useSlotSelection.ts @@ -28,7 +28,7 @@ const useSlotSeletion = () => { }); removeOverlappedSlots(endSlot, dateOfStartSlot); } - setStartSlot(undefined); + setStartSlot(null); }; const handleDeleteSlot = (selectedEntryId: number) => { @@ -62,11 +62,11 @@ const useSlotSeletion = () => { const onClickSlot = (targetSlot: string, selectedEntryId?: number) => { if (selectedEntryId !== undefined) { - if (startSlot === undefined) { + if (startSlot === null) { handleDeleteSlot(selectedEntryId); } - setStartSlot(undefined); - } else if (startSlot !== undefined) { + setStartSlot(null); + } else if (startSlot !== null) { handleCompleteSlot(targetSlot); } else { handleSelectSlot(targetSlot); diff --git a/src/pages/selectSchedule/contexts/useScheduleStepContext.ts b/src/pages/selectSchedule/contexts/useScheduleStepContext.ts index 9488eaa4..9e8d078a 100644 --- a/src/pages/selectSchedule/contexts/useScheduleStepContext.ts +++ b/src/pages/selectSchedule/contexts/useScheduleStepContext.ts @@ -9,7 +9,7 @@ interface ScheduleStepContextType { export const ScheduleStepContext = createContext({ scheduleStep: 'selectTimeSlot', - setScheduleStep: () => undefined, + setScheduleStep: () => null, }); export function useScheduleStepContext() { diff --git a/src/pages/selectSchedule/contexts/useSelectContext.ts b/src/pages/selectSchedule/contexts/useSelectContext.ts index 2ab073d0..48562f9f 100644 --- a/src/pages/selectSchedule/contexts/useSelectContext.ts +++ b/src/pages/selectSchedule/contexts/useSelectContext.ts @@ -12,17 +12,17 @@ export interface SelectedSlotType { } interface SelectContextType { - startSlot: string | undefined; + startSlot: string | null; setStartSlot: Dispatch>; selectedSlots: SelectedSlotType; setSelectedSlots: Dispatch>; } export const SelectContext = createContext({ - startSlot: undefined, - setStartSlot: () => undefined, + startSlot: null, + setStartSlot: () => null, selectedSlots: {}, - setSelectedSlots: () => undefined, + setSelectedSlots: () => null, }); export function useSelectContext() {