Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Dynamic Group Links on vercel (#9576)

Hariom Balharabed359531464
diff --git a/apps/web/pages/[user]/[type].tsx b/apps/web/pages/[user]/[type].tsx
index b72d5460e2e..daa3a825980 100644
--- a/apps/web/pages/[user]/[type].tsx
+++ b/apps/web/pages/[user]/[type].tsx
@@ -4,6 +4,7 @@ import { z } from "zod";
import type { LocationObject } from "@calcom/app-store/locations";
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";
+import { getUsernameList } from "@calcom/lib/defaultEvents";
import hasKeyInMetadata from "@calcom/lib/hasKeyInMetadata";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
@@ -236,7 +237,7 @@ async function getDynamicGroupPageProps(context: GetServerSidePropsContext) {
const { getAppFromSlug } = await import("@calcom/app-store/utils");
- const { type: typeParam, user: userParam } = paramsSchema.parse(context.query);
+ const { type: typeParam, user: userParam } = paramsSchema.parse(context.params);
const usernameList = getUsernameList(userParam);
const length = parseInt(typeParam);
const eventType = getDefaultEvent("" + length);
@@ -358,9 +359,9 @@ async function getDynamicGroupPageProps(context: GetServerSidePropsContext) {
}
export async function getServerSideProps(context: GetServerSidePropsContext) {
- const { user: userParam } = paramsSchema.parse(context.query);
+ const { user: userParam } = paramsSchema.parse(context.params);
// dynamic groups are not generated at build time, but otherwise are probably cached until infinity.
- const isDynamicGroup = userParam.includes("+");
+ const isDynamicGroup = getUsernameList(userParam).length > 1;
if (isDynamicGroup) {
return await getDynamicGroupPageProps(context);
} else {
diff --git a/apps/web/pages/new-booker/[user]/[type].tsx b/apps/web/pages/new-booker/[user]/[type].tsx
index 705d9114f20..5eabd337b71 100644
--- a/apps/web/pages/new-booker/[user]/[type].tsx
+++ b/apps/web/pages/new-booker/[user]/[type].tsx
@@ -154,7 +154,7 @@ const paramsSchema = z.object({ type: z.string(), user: z.string() });
// whether the page should show an away state or dynamic booking not allowed.
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const { user } = paramsSchema.parse(context.params);
- const isDynamicGroup = user.includes("+");
+ const isDynamicGroup = getUsernameList(user).length > 1;
return isDynamicGroup ? await getDynamicGroupPageProps(context) : await getUserPageProps(context);
};