diff --git a/apps/next-app-router/app/Variant.tsx b/apps/next-app-router/app/Variant.tsx index 2637fad1..847d39c8 100644 --- a/apps/next-app-router/app/Variant.tsx +++ b/apps/next-app-router/app/Variant.tsx @@ -1,13 +1,12 @@ -import dynamic from 'next/dynamic' +import { lazy } from 'react' -const DefaultVariant = dynamic(() => import('./variants/default')) -const GroqStoreVariant = dynamic(() => import('./variants/groq-store')) -const LiveStoreVariant = dynamic(() => import('./variants/live-store')) +const GroqStoreVariant = lazy(() => import('./variants/groq-store')) +const LiveStoreVariant = lazy(() => import('./variants/live-store')) export default function Variant(props: React.PropsWithChildren) { switch (process.env.VARIANT || 'default') { case 'default': - return + return <>{props.children} case 'groq-store': return case 'live-store': diff --git a/apps/next-app-router/app/layout.tsx b/apps/next-app-router/app/layout.tsx index f46d8e6d..5aa61589 100644 --- a/apps/next-app-router/app/layout.tsx +++ b/apps/next-app-router/app/layout.tsx @@ -4,6 +4,8 @@ import { unstable__adapter, unstable__environment } from '@sanity/client' import DraftModeButton from './DraftModeButton' import type { Metadata } from 'next' +export const runtime = 'edge' + export const metadata: Metadata = { title: `next-app-router-${process.env.VARIANT || 'default'}`, } diff --git a/apps/next-app-router/app/page.tsx b/apps/next-app-router/app/page.tsx index 48128cfc..fd4cccdd 100644 --- a/apps/next-app-router/app/page.tsx +++ b/apps/next-app-router/app/page.tsx @@ -16,6 +16,8 @@ import Variant from './Variant' import { PreviewTable, PreviewFooter } from './previews' import { Suspense } from 'react' +export const runtime = 'edge' + export default async function Page() { const footer = await sanityFetch({ query: footerQuery, @@ -32,6 +34,7 @@ export default async function Page() { initialData={footer} query={footerQuery} as={PreviewFooter} + throwOnMissingProvider={false} >