From b3acf31f3923ad74a3d30c6f79fb0510b9b158bc Mon Sep 17 00:00:00 2001 From: seaerchin Date: Tue, 25 Jun 2024 18:50:00 +0800 Subject: [PATCH] fix: page.router update to query + add await --- .../features/editing-experience/components/Preview.tsx | 4 +++- apps/studio/src/server/modules/page/page.router.ts | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/studio/src/features/editing-experience/components/Preview.tsx b/apps/studio/src/features/editing-experience/components/Preview.tsx index bb35fb64fc..0ce3ce78a6 100644 --- a/apps/studio/src/features/editing-experience/components/Preview.tsx +++ b/apps/studio/src/features/editing-experience/components/Preview.tsx @@ -1,4 +1,5 @@ import { + type IsomerComponent, type IsomerPageSchema, RenderEngine, } from '@opengovsg/isomer-components' @@ -50,7 +51,8 @@ export default function Preview({ schema }: PreviewProps) { permalink: '/', lastModified: new Date().toISOString(), }} - content={renderSchema.content} + // TODO: remove this cast and add validation + content={data.content.content as IsomerComponent[]} /> ) } diff --git a/apps/studio/src/server/modules/page/page.router.ts b/apps/studio/src/server/modules/page/page.router.ts index 63f32e6f7b..2cb4900024 100644 --- a/apps/studio/src/server/modules/page/page.router.ts +++ b/apps/studio/src/server/modules/page/page.router.ts @@ -17,19 +17,17 @@ export const pageRouter = router({ .input(getEditPageSchema) .query(async ({ input, ctx }) => { const { pageId } = input + // const page = await getFullPageById(pageId) const page = await getFullPageById(pageId) // TODO: Fill these in later const pageName: string = page.name const siteMeta = getSiteConfig(page.siteId) - const navbar = getNavBar(page.siteId) - const footer = getFooter(page.siteId) + const navbar = await getNavBar(page.siteId) + const footer = await getFooter(page.siteId) const { content } = page return { pageName, - // NOTE: might shift theme, isGovt, navbar, footer out into separate function? - // because this is shared across the whole site (site level props) - ...siteMeta, navbar, footer, content,