Skip to content

Scheduling infrastructure for absolutely everyone.

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

Hariom Balhara8d73d15b8a38
diff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsx
index a5f183cc3a8..fb53c0e7f3b 100644
--- a/packages/features/bookings/Booker/Booker.tsx
+++ b/packages/features/bookings/Booker/Booker.tsx
@@ -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>
);
diff --git a/packages/features/bookings/Booker/framer-features.tsx b/packages/features/bookings/Booker/framer-features.tsx
new file mode 100644
index 00000000000..95d798ae6e4
--- /dev/null
+++ b/packages/features/bookings/Booker/framer-features.tsx
@@ -0,0 +1,3 @@
+import { domAnimation } from "framer-motion";
+
+export default domAnimation;