Skip to content

Commit eff5129

Browse files
authored
fix(next): unable to pass custom view client components (#6513)
1 parent 38e5adc commit eff5129

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/next/src/views/Root/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { I18n } from '@payloadcms/translations'
22
import type { Metadata } from 'next'
33
import type { SanitizedConfig } from 'payload/types'
44

5+
import { WithServerSideProps } from '@payloadcms/ui/elements/WithServerSideProps'
56
import { DefaultTemplate } from '@payloadcms/ui/templates/Default'
67
import { MinimalTemplate } from '@payloadcms/ui/templates/Minimal'
78
import { notFound, redirect } from 'next/navigation.js'
@@ -82,7 +83,16 @@ export const RootPage = async ({
8283
}
8384

8485
const RenderedView = (
85-
<DefaultView initPageResult={initPageResult} params={params} searchParams={searchParams} />
86+
<WithServerSideProps
87+
Component={DefaultView}
88+
serverOnlyProps={
89+
{
90+
initPageResult,
91+
params,
92+
searchParams,
93+
} as any
94+
}
95+
/>
8696
)
8797

8898
return (

0 commit comments

Comments
 (0)