perf: Lazy load framer motion stuff as much as we can (#10876)

This commit is contained in:
Hariom Balhara
2023-08-24 13:40:01 -07:00
committed by GitHub
parent e8370ef950
commit 8d73d15b8a
2 changed files with 6 additions and 2 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import { LazyMotion, domAnimation, m, AnimatePresence } from "framer-motion";
import { LazyMotion, m, AnimatePresence } from "framer-motion";
import dynamic from "next/dynamic";
import { useEffect, useRef } from "react";
import StickyBox from "react-sticky-box";
@@ -26,6 +26,7 @@ import { validateLayout } from "./utils/layout";
import { getQueryParam } from "./utils/query-param";
import { useBrandColors } from "./utils/use-brand-colors";
const loadFramerFeatures = () => import("./framer-features").then((res) => res.default);
const PoweredBy = dynamic(() => import("@calcom/ee/components/PoweredBy"));
const UnpublishedEntity = dynamic(() => import("@calcom/ui").then((mod) => mod.UnpublishedEntity));
const DatePicker = dynamic(() => import("./components/DatePicker").then((mod) => mod.DatePicker), {
@@ -319,7 +320,7 @@ export const Booker = (props: BookerProps) => {
if (props.isAway) return <Away />;
return (
<LazyMotion features={domAnimation}>
<LazyMotion strict features={loadFramerFeatures}>
<BookerComponent {...props} />
</LazyMotion>
);
@@ -0,0 +1,3 @@
import { domAnimation } from "framer-motion";
export default domAnimation;