Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit cf7796b

Browse files
committed
fix: select controlled -> uncontrolled
1 parent 954d9f3 commit cf7796b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/common/src/components/form/TimeRangePicker.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
useController,
99
UseControllerProps,
1010
} from "react-hook-form";
11-
import { type OptionType } from "../../../types/common";
1211
import { truncatedText } from "../../../styles/styledComponentUtils";
1312
import { removeRefParam } from "../../reservation-form/util";
1413

@@ -29,6 +28,10 @@ interface PopulateTimesProps {
2928
intervalMinutes?: number;
3029
}
3130

31+
type OptionType = {
32+
label: string;
33+
value: number;
34+
};
3235
const StyledSelect = styled(Select<OptionType>)`
3336
button {
3437
display: grid;
@@ -83,8 +86,8 @@ const TimeRangePicker = <T extends FieldValues>({
8386
const getSelectedOption = (
8487
optionValue: string | null,
8588
optionList: OptionType[]
86-
): OptionType | undefined => {
87-
return optionList.find((o) => o.label === optionValue);
89+
): OptionType | null => {
90+
return optionList.find((o) => o.label === optionValue) ?? null;
8891
};
8992
const populateTimes = (
9093
populateTimesProps?: PopulateTimesProps

0 commit comments

Comments
 (0)