diff options
Diffstat (limited to 'packages/bun-framework-next/renderDocument.tsx')
-rw-r--r-- | packages/bun-framework-next/renderDocument.tsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/bun-framework-next/renderDocument.tsx b/packages/bun-framework-next/renderDocument.tsx index 463395863..615224f0d 100644 --- a/packages/bun-framework-next/renderDocument.tsx +++ b/packages/bun-framework-next/renderDocument.tsx @@ -243,6 +243,7 @@ function renderDocument( scriptLoader, locale, disableOptimizedLoading, + useMaybeDeferContent, ...docProps, }; return ( @@ -567,6 +568,17 @@ export async function render({ </AppContainer> ); }, + defaultGetInitialProps: async ( + docCtx: DocumentContext + ): Promise<DocumentInitialProps> => { + const enhanceApp = (AppComp: any) => { + return (props: any) => <AppComp {...props} />; + }; + + const { html, head } = await docCtx.renderPage({ enhanceApp }); + // const styles = jsxStyleRegistry.styles(); + return { html, head }; + }, }; var props = await loadGetInitialProps(AppComponent, { @@ -789,6 +801,7 @@ export async function render({ isPreview: isPreview === true ? true : undefined, autoExport: isAutoExport === true ? true : undefined, nextExport: nextExport === true ? true : undefined, + useMaybeDeferContent, }); const bodyRenderIdx = html.indexOf(BODY_RENDER_TARGET); html = @@ -812,3 +825,10 @@ export async function render({ ); } } + +export function useMaybeDeferContent( + _name: string, + contentFn: () => JSX.Element +): [boolean, JSX.Element] { + return [false, contentFn()]; +} |