Fixing multiple duration not selected correctly (#7597)

pull/7623/head
Leo Giovanetti 2023-03-09 07:12:37 -03:00 committed by GitHub
parent 5ebbd514d8
commit 3a6f05f1e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -46,14 +46,16 @@ const BookingDescription: FC<Props> = (props) => {
const { profile, eventType, isBookingPage = false, children } = props;
const { date: bookingDate } = useRouterQuery("date");
const { t } = useLocale();
const { duration = eventType.length.toString(), setQuery: setDuration } = useRouterQuery("duration");
const { duration, setQuery: setDuration } = useRouterQuery("duration");
useEffect(() => {
if (
eventType.metadata?.multipleDuration &&
!eventType.metadata?.multipleDuration?.includes(Number(duration))
!duration ||
isNaN(Number(duration)) ||
(eventType.metadata?.multipleDuration &&
!eventType.metadata?.multipleDuration.includes(Number(duration)))
) {
setDuration(eventType.length.toString());
setDuration(eventType.length);
}
}, [duration, setDuration, eventType.length, eventType.metadata?.multipleDuration]);