Skip to content

Commit 245196f

Browse files
authored
chore: technical debt clearing - remove getServerSideProps for /event-types (#18733)
* chore: technical debt clearing - remove getServerSideProps for event-types * refactor
1 parent 6be69b8 commit 245196f

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

apps/web/app/event-types/page.tsx

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import { withAppDirSsr } from "app/WithAppDirSsr";
1+
import type { PageProps } from "app/_types";
22
import { _generateMetadata } from "app/_utils";
33
import { WithLayout } from "app/layoutHOC";
4+
import { cookies, headers } from "next/headers";
5+
import { redirect } from "next/navigation";
46

5-
import { getServerSideProps } from "@lib/event-types/getServerSideProps";
7+
import { getServerSessionForAppDir } from "@calcom/features/auth/lib/get-server-session-for-app-dir";
8+
9+
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
10+
11+
import { ssrInit } from "@server/lib/ssr";
612

713
import EventTypes from "~/event-types/views/event-types-listing-view";
814

@@ -12,6 +18,16 @@ export const generateMetadata = async () =>
1218
(t) => t("event_types_page_subtitle")
1319
);
1420

15-
const getData = withAppDirSsr(getServerSideProps);
21+
const Page = async ({ params, searchParams }: PageProps) => {
22+
const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
23+
const session = await getServerSessionForAppDir();
24+
if (!session?.user?.id) {
25+
redirect("/auth/login");
26+
}
27+
28+
await ssrInit(context);
29+
30+
return <EventTypes />;
31+
};
1632

17-
export default WithLayout({ getLayout: null, getData, Page: EventTypes })<"P">;
33+
export default WithLayout({ ServerPage: Page })<"P">;

apps/web/lib/event-types/getServerSideProps.tsx

-21
This file was deleted.

apps/web/modules/event-types/views/event-types-listing-view.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,6 @@ const InfiniteScrollMain = ({
944944

945945
const EventTypesPage: React.FC = () => {
946946
const { t } = useLocale();
947-
const searchParams = useSearchParams();
948947
const { data: user } = useMeQuery();
949948
// eslint-disable-next-line @typescript-eslint/no-unused-vars
950949
const [_showProfileBanner, setShowProfileBanner] = useState(false);

0 commit comments

Comments
 (0)