Skip to content

Commit

Permalink
refactor(component): improve document component
Browse files Browse the repository at this point in the history
  • Loading branch information
GervinFung committed Sep 22, 2024
1 parent 3d0f393 commit 0795cb1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/web/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Document, { Head, Main, NextScript, Html } from 'next/document';
import React from 'react';

export default class Doc extends Document {
static override getInitialProps = async (context: DocumentContext) => {
static override async getInitialProps(context: DocumentContext) {
const { renderPage: originalRenderPage } = context;

// Run the React rendering logic synchronously
Expand All @@ -22,10 +22,10 @@ export default class Doc extends Document {
};

// Run the parent `getInitialProps`, it now includes the custom `renderPage`
return await Document.getInitialProps(context);
};
return await super.getInitialProps(context);
}

override render = () => {
override render() {
return (
<Html lang="en">
<Head>
Expand All @@ -43,5 +43,5 @@ export default class Doc extends Document {
</body>
</Html>
);
};
}
}

0 comments on commit 0795cb1

Please sign in to comment.