From 5db525a62d4069e9a7170c8fa790875ed1d8d404 Mon Sep 17 00:00:00 2001 From: hexcowboy Date: Tue, 13 Sep 2022 03:59:53 -0700 Subject: [PATCH] dynamic import rainbow (only if installed) (#4409) --- apps/web/components/Gates.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/components/Gates.tsx b/apps/web/components/Gates.tsx index 6fa5ebc79f..114c32cc9c 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>; }; +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 = ({ children, gates, metadata, dispatch }) => { const [rainbowToken, setRainbowToken] = useState();