fix: profile banner delay for orgs + small DX chore (#10546)

* Fixing profile banner delay for orgs

* Separating into other useEffect
This commit is contained in:
Leo Giovanetti 2023-08-10 14:50:43 -03:00 committed by GitHub
parent f3eb490e3b
commit 49a61207d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -923,11 +923,14 @@ const EventTypesPage = () => {
if (searchParams?.get("openIntercom") === "true") {
open();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
setShowProfileBanner(
!!orgBranding && !document.cookie.includes("calcom-profile-banner=1") && !user?.completedOnboarding
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [orgBranding, user]);
return (
<ShellMain

View File

@ -132,7 +132,6 @@ function useRedirectToLoginIfUnauthenticated(isPublic = false) {
}
function AppTop({ setBannersHeight }: { setBannersHeight: Dispatch<SetStateAction<number>> }) {
const router = useRouter();
const bannerRef = useRef<HTMLDivElement | null>(null);
useIsomorphicLayoutEffect(() => {

View File

@ -5,7 +5,12 @@ import { sendOrganizationEmailVerification } from "@calcom/emails";
import { hashPassword } from "@calcom/features/auth/lib/hashPassword";
import { subdomainSuffix } from "@calcom/features/ee/organizations/lib/orgDomains";
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "@calcom/lib/availability";
import { IS_CALCOM, IS_TEAM_BILLING_ENABLED, RESERVED_SUBDOMAINS } from "@calcom/lib/constants";
import {
IS_CALCOM,
IS_TEAM_BILLING_ENABLED,
RESERVED_SUBDOMAINS,
IS_PRODUCTION,
} from "@calcom/lib/constants";
import { getTranslation } from "@calcom/lib/server/i18n";
import { prisma } from "@calcom/prisma";
import { MembershipRole } from "@calcom/prisma/enums";
@ -131,6 +136,7 @@ export const createHandler = async ({ input, ctx }: CreateOptions) => {
return { user: { ...createOwnerOrg, password } };
} else {
if (!IS_PRODUCTION) return { checked: true };
const language = await getTranslation(input.language ?? "en", "common");
const secret = createHash("md5")