diff --git a/apps/web/modules/auth/forgot-password/forgot-password-view.tsx b/apps/web/modules/auth/forgot-password/forgot-password-view.tsx index d7dfd80cc5b1e6..4dd46520b898aa 100644 --- a/apps/web/modules/auth/forgot-password/forgot-password-view.tsx +++ b/apps/web/modules/auth/forgot-password/forgot-password-view.tsx @@ -54,9 +54,18 @@ export default function ForgotPassword(props: PageProps) { } }; - const debouncedHandleSubmitPasswordRequest = debounce(submitForgotPasswordRequest, 250); + const submitRef = React.useRef(submitForgotPasswordRequest); + submitRef.current = submitForgotPasswordRequest; - const handleSubmit = async (e: SyntheticEvent) => { + const debouncedHandleSubmitPasswordRequest = React.useRef( + debounce((args: { email: string }) => submitRef.current(args), 250) + ).current; + + React.useEffect(() => { + return () => debouncedHandleSubmitPasswordRequest.cancel(); + }, []); + + const handleSubmit = (e: SyntheticEvent) => { e.preventDefault(); if (!email) { @@ -71,7 +80,7 @@ export default function ForgotPassword(props: PageProps) { setError(null); setSuccess(false); - await debouncedHandleSubmitPasswordRequest({ email }); + debouncedHandleSubmitPasswordRequest({ email }); }; const Success = () => { diff --git a/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts b/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts index 1884b952250646..f8a70d68eba3b7 100644 --- a/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts +++ b/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts @@ -66,6 +66,10 @@ export function keepParentInformedAboutDimensionChanges({ embedStore }: { embedS let isInitialDimensionPass = true; let isWindowLoadComplete = false; runAsap(function informAboutScroll() { + // Can't inform parent about dimensions if document doesn't exist + if (typeof document === "undefined") { + return; + } if (document.readyState !== "complete") { // Wait for window to load to correctly calculate the initial scroll height. runAsap(informAboutScroll); diff --git a/packages/features/users/lib/getRoutedUsers.test.ts b/packages/features/users/lib/getRoutedUsers.test.ts index 09b853683f4ff2..72e40718322146 100644 --- a/packages/features/users/lib/getRoutedUsers.test.ts +++ b/packages/features/users/lib/getRoutedUsers.test.ts @@ -1,5 +1,4 @@ -import { describe, it, expect, vi } from "vitest"; - +import { describe, expect, it, vi } from "vitest"; import { getRoutedUsersWithContactOwnerAndFixedUsers } from "./getRoutedUsers"; vi.mock("@calcom/prisma", () => { @@ -8,6 +7,12 @@ vi.mock("@calcom/prisma", () => { }; }); +vi.mock("@calcom/app-store/delegationCredential", () => { + return { + enrichHostsWithDelegationCredentials: vi.fn().mockResolvedValue([]), + }; +}); + describe("getRoutedUsersWithContactOwnerAndFixedUsers", () => { const users = [ { id: 1, email: "user1@example.com", isFixed: false },