@@ -6,6 +6,7 @@ import { prepareCustomLabel } from '@/utils/customLabels'
66import { getPreviewMode } from '@/utils/previewMode'
77import { safeCompile } from '@/utils/safeCompile'
88import { preprocessTemplate } from '@/utils/string'
9+ import Head from 'next/head'
910import Image from 'next/image'
1011import { z } from 'zod'
1112import { defaultState } from '../../../defaultState'
@@ -69,9 +70,9 @@ async function getCustomFields(token: string) {
6970export default async function ClientPreviewPage ( {
7071 searchParams,
7172} : {
72- searchParams : { token : string }
73+ searchParams : Promise < { token : string } >
7374} ) {
74- const tokenParsed = z . string ( ) . safeParse ( searchParams . token )
75+ const tokenParsed = z . string ( ) . safeParse ( ( await searchParams ) . token )
7576 if ( ! tokenParsed . success ) {
7677 return < InvalidToken />
7778 }
@@ -111,7 +112,7 @@ export default async function ClientPreviewPage({
111112 const [ defaultSetting , allCustomFields , _client , workspace ] =
112113 await Promise . all ( [
113114 getSettings ( token ) ,
114- getCustomFields ( searchParams . token ) ,
115+ getCustomFields ( token ) ,
115116 getClient ( clientId . data , token ) ,
116117 copilotClient . getWorkspaceInfo ( ) ,
117118 ] )
@@ -180,12 +181,12 @@ export default async function ClientPreviewPage({
180181
181182 return (
182183 < >
183- < head >
184+ < Head >
184185 < link
185186 href = { `https://fonts.googleapis.com/css2?family=${ workspace . font } &display=swap` }
186187 rel = 'stylesheet'
187188 />
188- </ head >
189+ </ Head >
189190 < div
190191 className = { `overflow-y-auto overflow-x-hidden max-h-screen w-full` }
191192 style = { {
@@ -218,7 +219,7 @@ export default async function ClientPreviewPage({
218219 < ClientPreview
219220 content = { htmlContent }
220221 settings = { settings }
221- token = { searchParams . token }
222+ token = { token }
222223 font = { workspace . font }
223224 labels = { workspace . labels }
224225 />
0 commit comments