Skip to content

Scheduling infrastructure for absolutely everyone.

fix: remove circular dependency by moving useLastUsed hook to auth features (#24552)

Keith Williams68f9e86cdd84
diff --git a/apps/web/modules/auth/login-view.tsx b/apps/web/modules/auth/login-view.tsx
index c6a60ff0f5c..30da9693338 100644
--- a/apps/web/modules/auth/login-view.tsx
+++ b/apps/web/modules/auth/login-view.tsx
@@ -11,11 +11,11 @@ import { z } from "zod";
import { SAMLLogin } from "@calcom/features/auth/SAMLLogin";
import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";
+import { LastUsed, useLastUsed } from "@calcom/features/auth/lib/hooks/useLastUsed";
import { HOSTED_CAL_FEATURES, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
import { emailRegex } from "@calcom/lib/emailSchema";
import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
-import { LastUsed, useLastUsed } from "@calcom/lib/hooks/useLastUsed";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useTelemetry } from "@calcom/lib/hooks/useTelemetry";
import { collectPageParameters, telemetryEventTypes } from "@calcom/lib/telemetry";
@@ -62,7 +62,7 @@ export default function Login({
.string()
.min(1, `${t("error_required_field")}`)
.regex(emailRegex, `${t("enter_valid_email")}`),
- ...(!!totpEmail ? {} : { password: z.string().min(1, `${t("error_required_field")}`) }),
+ ...(totpEmail ? {} : { password: z.string().min(1, `${t("error_required_field")}`) }),
})
// Passthrough other fields like totpCode
.passthrough();
diff --git a/packages/features/auth/SAMLLogin.tsx b/packages/features/auth/SAMLLogin.tsx
index 0ea0a265919..98fbbe3724e 100644
--- a/packages/features/auth/SAMLLogin.tsx
+++ b/packages/features/auth/SAMLLogin.tsx
@@ -3,9 +3,9 @@ import type { Dispatch, SetStateAction } from "react";
import { useFormContext } from "react-hook-form";
import z from "zod";
+import { LastUsed, useLastUsed } from "@calcom/features/auth/lib/hooks/useLastUsed";
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
import { emailRegex } from "@calcom/lib/emailSchema";
-import { LastUsed, useLastUsed } from "@calcom/lib/hooks/useLastUsed";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import type { ButtonProps } from "@calcom/ui/components/button";
diff --git a/packages/lib/hooks/useLastUsed.tsx b/packages/features/auth/lib/hooks/useLastUsed.tsx
similarity index 100%
rename from packages/lib/hooks/useLastUsed.tsx
rename to packages/features/auth/lib/hooks/useLastUsed.tsx