From a2e0d44fb87b3f7fed3881f4b65ad3d536556b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Tue, 11 Jul 2023 03:06:44 -0700 Subject: [PATCH] fix: prevents warnings on branding call when unauthed (#10051) --- packages/features/ee/organizations/hooks/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/features/ee/organizations/hooks/index.ts b/packages/features/ee/organizations/hooks/index.ts index bbaac3a8f5..7a09b7f7fa 100644 --- a/packages/features/ee/organizations/hooks/index.ts +++ b/packages/features/ee/organizations/hooks/index.ts @@ -1,5 +1,12 @@ +import { useSession } from "next-auth/react"; + import { trpc } from "@calcom/trpc/react"; export function useOrgBrandingValues() { - return trpc.viewer.organizations.getBrand.useQuery().data; + const session = useSession(); + return trpc.viewer.organizations.getBrand.useQuery(undefined, { + // Only fetch if we have a session to avoid flooding logs with errors + enabled: session.status === "authenticated", + initialData: null, + }).data; }