@@ -282,20 +293,3 @@ export default function Availability({ schedule }: { schedule: number }) {
);
}
-
-export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
- const params = querySchema.safeParse(ctx.params);
- const ssr = await ssrInit(ctx);
-
- if (!params.success) return { notFound: true };
-
- const scheduleId = params.data.schedule;
- await ssr.viewer.availability.schedule.get.fetch({ scheduleId });
- await ssr.viewer.availability.defaultValues.fetch({ scheduleId });
- return {
- props: {
- schedule: scheduleId,
- trpcState: ssr.dehydrate(),
- },
- };
-};
diff --git a/packages/app-store/applecalendar/package.json b/packages/app-store/applecalendar/package.json
index fe5b883c50..8809bf7cb8 100644
--- a/packages/app-store/applecalendar/package.json
+++ b/packages/app-store/applecalendar/package.json
@@ -7,7 +7,7 @@
"description": "Apple calendar runs both the macOS and iOS mobile operating systems. Offering online cloud backup of calendars using Appleās iCloud service, it can sync with Google Calendar and Microsoft Exchange Server. Users can schedule events in their day that include time, location, duration, and extra notes.",
"dependencies": {
"@calcom/prisma": "*",
- "react-hook-form": "^7.34.2"
+ "react-hook-form": "^7.43.3"
},
"devDependencies": {
"@calcom/types": "*"
diff --git a/packages/app-store/caldavcalendar/package.json b/packages/app-store/caldavcalendar/package.json
index 36b2fabd81..01a9a3ba35 100644
--- a/packages/app-store/caldavcalendar/package.json
+++ b/packages/app-store/caldavcalendar/package.json
@@ -10,7 +10,7 @@
"@calcom/lib": "*",
"@calcom/prisma": "*",
"@calcom/ui": "*",
- "react-hook-form": "^7.34.2"
+ "react-hook-form": "^7.43.3"
},
"devDependencies": {
"@calcom/types": "*"
diff --git a/packages/app-store/exchange2013calendar/package.json b/packages/app-store/exchange2013calendar/package.json
index ecb5e23752..216eba4ca4 100644
--- a/packages/app-store/exchange2013calendar/package.json
+++ b/packages/app-store/exchange2013calendar/package.json
@@ -9,7 +9,7 @@
"@calcom/lib": "*",
"@calcom/prisma": "*",
"@calcom/ui": "*",
- "react-hook-form": "^7.34.2",
+ "react-hook-form": "^7.43.3",
"ews-javascript-api": "^0.11.0"
},
"devDependencies": {
diff --git a/packages/app-store/exchange2016calendar/package.json b/packages/app-store/exchange2016calendar/package.json
index 982317eda1..480fa52b8c 100644
--- a/packages/app-store/exchange2016calendar/package.json
+++ b/packages/app-store/exchange2016calendar/package.json
@@ -9,7 +9,7 @@
"@calcom/lib": "*",
"@calcom/prisma": "*",
"@calcom/ui": "*",
- "react-hook-form": "^7.34.2",
+ "react-hook-form": "^7.43.3",
"ews-javascript-api": "^0.11.0"
},
"devDependencies": {
diff --git a/packages/features/schedules/components/DateOverrideInputDialog.tsx b/packages/features/schedules/components/DateOverrideInputDialog.tsx
index 9695398b4b..a54a4092ba 100644
--- a/packages/features/schedules/components/DateOverrideInputDialog.tsx
+++ b/packages/features/schedules/components/DateOverrideInputDialog.tsx
@@ -1,12 +1,13 @@
-import { useState, useEffect, useMemo } from "react";
+import { useState, useMemo } from "react";
import { useForm } from "react-hook-form";
-import dayjs, { Dayjs } from "@calcom/dayjs";
+import type { Dayjs } from "@calcom/dayjs";
+import dayjs from "@calcom/dayjs";
import { classNames } from "@calcom/lib";
import { daysInMonth, yyyymmdd } from "@calcom/lib/date-fns";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";
-import { WorkingHours } from "@calcom/types/schedule";
+import type { WorkingHours } from "@calcom/types/schedule";
import {
Dialog,
DialogContent,
@@ -19,12 +20,8 @@ import {
} from "@calcom/ui";
import DatePicker from "../../calendars/DatePicker";
-import { DayRanges, TimeRange } from "./Schedule";
-
-const ALL_DAY_RANGE = {
- start: new Date(dayjs.utc().hour(0).minute(0).second(0).format()),
- end: new Date(dayjs.utc().hour(0).minute(0).second(0).format()),
-};
+import type { TimeRange } from "./Schedule";
+import { DayRanges } from "./Schedule";
// eslint-disable-next-line @typescript-eslint/no-empty-function
const noop = () => {};
@@ -70,37 +67,33 @@ const DateOverrideForm = ({
[browsingDate]
);
- const form = useForm<{ range: TimeRange[] }>();
- const { reset } = form;
-
- useEffect(() => {
- if (value) {
- reset({
- range: value.map((range) => ({
- start: new Date(
- dayjs.utc().hour(range.start.getUTCHours()).minute(range.start.getUTCMinutes()).second(0).format()
- ),
- end: new Date(
- dayjs.utc().hour(range.end.getUTCHours()).minute(range.end.getUTCMinutes()).second(0).format()
- ),
- })),
- });
- return;
- }
- const dayRanges = (workingHours || []).reduce((dayRanges, workingHour) => {
- if (date && workingHour.days.includes(date.day())) {
- dayRanges.push({
- start: dayjs.utc().startOf("day").add(workingHour.startTime, "minute").toDate(),
- end: dayjs.utc().startOf("day").add(workingHour.endTime, "minute").toDate(),
- });
- }
- return dayRanges;
- }, [] as TimeRange[]);
- reset({
- range: dayRanges,
- });
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [date, value]);
+ const form = useForm({
+ values: {
+ range: value
+ ? value.map((range) => ({
+ start: new Date(
+ dayjs
+ .utc()
+ .hour(range.start.getUTCHours())
+ .minute(range.start.getUTCMinutes())
+ .second(0)
+ .format()
+ ),
+ end: new Date(
+ dayjs.utc().hour(range.end.getUTCHours()).minute(range.end.getUTCMinutes()).second(0).format()
+ ),
+ }))
+ : (workingHours || []).reduce((dayRanges, workingHour) => {
+ if (date && workingHour.days.includes(date.day())) {
+ dayRanges.push({
+ start: dayjs.utc().startOf("day").add(workingHour.startTime, "minute").toDate(),
+ end: dayjs.utc().startOf("day").add(workingHour.endTime, "minute").toDate(),
+ });
+ }
+ return dayRanges;
+ }, [] as TimeRange[]),
+ },
+ });
return (