Skip to content

Commit 532f032

Browse files
committed
Resolve comments
1 parent f20fb16 commit 532f032

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ public/robots.txt
4040

4141
# storybook
4242
storybook-static
43+
44+
# new relic
45+
newrelic_agent.log

src/pages/_document.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import Document, { Html, Head, Main, NextScript, DocumentContext, DocumentInitialProps } from 'next/document';
1+
import Document, { Html, Head, Main, NextScript, DocumentContext, DocumentProps } from 'next/document';
22

33
const newrelic = require('newrelic');
44

5-
const AppDocument = ({ browserTimingHeader }: { browserTimingHeader: string }) => {
5+
type Props = DocumentProps & Awaited<ReturnType<Awaited<typeof getInitialProps>>>;
6+
7+
const AppDocument = ({ browserTimingHeader }: Props) => {
68
return (
79
<Html>
810
<Head>
@@ -18,9 +20,7 @@ const AppDocument = ({ browserTimingHeader }: { browserTimingHeader: string }) =
1820
);
1921
};
2022

21-
AppDocument.getInitialProps = async function (
22-
ctx: DocumentContext
23-
): Promise<DocumentInitialProps & { browserTimingHeader: string }> {
23+
export async function getInitialProps(ctx: DocumentContext) {
2424
const initialProps = await Document.getInitialProps(ctx);
2525

2626
const browserTimingHeader: string = newrelic.getBrowserTimingHeader({
@@ -31,6 +31,6 @@ AppDocument.getInitialProps = async function (
3131
...initialProps,
3232
browserTimingHeader,
3333
};
34-
};
34+
}
3535

3636
export default AppDocument;

0 commit comments

Comments
 (0)