diff --git a/apps/web/app/provider.tsx b/apps/web/app/provider.tsx index 7d6811052c..4d23fed9d3 100644 --- a/apps/web/app/provider.tsx +++ b/apps/web/app/provider.tsx @@ -1,5 +1,5 @@ import { lazy, Suspense } from "react"; -import { useTheme, ThemeProvider } from "next-themes"; +import { useTheme } from "next-themes"; import { SWRConfig } from "swr"; // Plane Imports import { WEB_SWR_CONFIG } from "@plane/constants"; @@ -9,44 +9,45 @@ import { Toast } from "@plane/propel/toast"; import { resolveGeneralTheme } from "@plane/utils"; // polyfills import "@/lib/polyfills"; -// progress bar -import { AppProgressBar } from "@/lib/b-progress"; // mobx store provider import { StoreProvider } from "@/lib/store-context"; -// wrappers -import { InstanceWrapper } from "@/lib/wrappers/instance-wrapper"; // lazy imports +const AppProgressBar = lazy(function AppProgressBar() { + return import("@/lib/b-progress/AppProgressBar"); +}); + const StoreWrapper = lazy(function StoreWrapper() { return import("@/lib/wrappers/store-wrapper"); }); -const PostHogProvider = lazy(function PostHogProvider() { - return import("@/lib/posthog-provider"); +const InstanceWrapper = lazy(function InstanceWrapper() { + return import("@/lib/wrappers/instance-wrapper"); }); const ChatSupportModal = lazy(function ChatSupportModal() { return import("@/components/global/chat-support-modal"); }); +const PostHogProvider = lazy(function PostHogProvider() { + return import("@/lib/posthog-provider"); +}); + export interface IAppProvider { children: React.ReactNode; } -function ToastWithTheme() { - const { resolvedTheme } = useTheme(); - return ; -} - export function AppProvider(props: IAppProvider) { const { children } = props; // themes + const { resolvedTheme } = useTheme(); + return ( - + <> - + @@ -58,7 +59,7 @@ export function AppProvider(props: IAppProvider) { - + ); } diff --git a/apps/web/app/root.tsx b/apps/web/app/root.tsx index 7ce3d16ff5..2fbfd46c64 100644 --- a/apps/web/app/root.tsx +++ b/apps/web/app/root.tsx @@ -3,6 +3,7 @@ import * as Sentry from "@sentry/react-router"; import Script from "next/script"; import { Links, Meta, Outlet, Scripts } from "react-router"; import type { LinksFunction } from "react-router"; +import { ThemeProvider, useTheme } from "next-themes"; // plane imports import { SITE_DESCRIPTION, SITE_NAME } from "@plane/constants"; import { cn } from "@plane/utils"; @@ -14,9 +15,10 @@ import faviconIco from "@/app/assets/favicon/favicon.ico?url"; import icon180 from "@/app/assets/icons/icon-180x180.png?url"; import icon512 from "@/app/assets/icons/icon-512x512.png?url"; import ogImage from "@/app/assets/og-image.png?url"; -import { LogoSpinner } from "@/components/common/logo-spinner"; import globalStyles from "@/styles/globals.css?url"; import type { Route } from "./+types/root"; +// components +import { LogoSpinner } from "@/components/common/logo-spinner"; // local import { CustomErrorComponent } from "./error"; import { AppProvider } from "./provider"; @@ -51,7 +53,7 @@ export function Layout({ children }: { children: ReactNode }) { const isSessionRecorderEnabled = parseInt(process.env.VITE_ENABLE_SESSION_RECORDER || "0"); return ( - + @@ -66,16 +68,12 @@ export function Layout({ children }: { children: ReactNode }) { - +
- -
-
{children}
-
-
+ + {children} + {!!isSessionRecorderEnabled && process.env.VITE_SESSION_RECORDER_KEY && (