Skip to content

Scheduling infrastructure for absolutely everyone.

dynamic import rainbow (only if installed) (#4409)

hexcowboy5db525a62d40
diff --git a/apps/web/components/Gates.tsx b/apps/web/components/Gates.tsx
index 6fa5ebc79ff..114c32cc9c1 100644
--- a/apps/web/components/Gates.tsx
+++ b/apps/web/components/Gates.tsx
@@ -1,8 +1,7 @@
+import dynamic from "next/dynamic";
import { Dispatch, useState, useEffect } from "react";
import { JSONObject } from "superjson/dist/types";
-import RainbowGate from "@calcom/app-store/rainbow/components/RainbowKit";
-
export type Gate = undefined | "rainbow"; // Add more like ` | "geolocation" | "payment"`
export type GateState = {
@@ -16,6 +15,8 @@ type GateProps = {
dispatch: Dispatch<Partial<GateState>>;
};
+const RainbowGate = dynamic(() => import("@calcom/app-store/rainbow/components/RainbowKit"));
+
// To add a new Gate just add the gate logic to the switch statement
const Gates: React.FC<GateProps> = ({ children, gates, metadata, dispatch }) => {
const [rainbowToken, setRainbowToken] = useState<string>();