Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

wrap modal provider in suspense

Steven Teyfb2886fd2795
diff --git a/apps/web/app/providers.tsx b/apps/web/app/providers.tsx
index 419061c4d2..e3ec0cdb09 100644
--- a/apps/web/app/providers.tsx
+++ b/apps/web/app/providers.tsx
@@ -1,7 +1,7 @@
"use client";
import { PosthogPageview } from "@/ui/layout/posthog-pageview";
-import ModalProvider from "@/ui/modals/provider";
+import { ModalProvider } from "@/ui/modals/modal-provider";
import { KeyboardShortcutProvider } from "@dub/ui";
import { Analytics as VercelAnalytics } from "@vercel/analytics/react";
import { SessionProvider } from "next-auth/react";
diff --git a/apps/web/ui/modals/provider.tsx b/apps/web/ui/modals/modal-provider.tsx
similarity index 96%
rename from apps/web/ui/modals/provider.tsx
rename to apps/web/ui/modals/modal-provider.tsx
index a3bc5fb1c5..6bfd4e08d5 100644
--- a/apps/web/ui/modals/provider.tsx
+++ b/apps/web/ui/modals/modal-provider.tsx
@@ -19,6 +19,7 @@ import {
Dispatch,
ReactNode,
SetStateAction,
+ Suspense,
createContext,
useEffect,
useMemo,
@@ -50,7 +51,15 @@ export const ModalContext = createContext<{
setShowImportRebrandlyModal: () => {},
});
-export default function ModalProvider({ children }: { children: ReactNode }) {
+export function ModalProvider({ children }: { children: ReactNode }) {
+ return (
+ <Suspense>
+ <ModalProviderClient>{children}</ModalProviderClient>
+ </Suspense>
+ );
+}
+
+function ModalProviderClient({ children }: { children: ReactNode }) {
const searchParams = useSearchParams();
const newLinkValues = useMemo(() => {
const newLink = searchParams.get("newLink");