Skip to content

Commit e4b178f

Browse files
tonyhallettgatsbybotLekoArts
authored andcommitted
fix(gatsby): Reuse readPageData (#33595)
Co-authored-by: gatsbybot <[email protected]> Co-authored-by: LekoArts <[email protected]>
1 parent 96babad commit e4b178f

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

packages/gatsby/src/utils/worker/child/render-html.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
import fs from "fs-extra"
44
import Bluebird from "bluebird"
55
import * as path from "path"
6-
import { generateHtmlPath, fixedPagePath } from "gatsby-core-utils"
6+
import { generateHtmlPath } from "gatsby-core-utils"
77
import { truncate } from "lodash"
88

99
import {
1010
readWebpackStats,
1111
getScriptsAndStylesForTemplate,
1212
clearCache as clearAssetsMappingCache,
1313
} from "../../client-assets-for-template"
14-
import type { IPageDataWithQueryResult } from "../../page-data"
14+
import { IPageDataWithQueryResult, readPageData } from "../../page-data"
1515
import type { IRenderHtmlResult } from "../../../commands/build-html"
1616
import {
1717
clearStaticQueryCaches,
@@ -53,21 +53,6 @@ function clearCaches(): void {
5353
clearAssetsMappingCache()
5454
}
5555

56-
async function readPageData(
57-
publicDir: string,
58-
pagePath: string
59-
): Promise<IPageDataWithQueryResult> {
60-
const filePath = join(
61-
publicDir,
62-
`page-data`,
63-
fixedPagePath(pagePath),
64-
`page-data.json`
65-
)
66-
const rawPageData = await fs.readFile(filePath, `utf-8`)
67-
68-
return JSON.parse(rawPageData)
69-
}
70-
7156
async function doGetResourcesForTemplate(
7257
pageData: IPageDataWithQueryResult
7358
): Promise<IResourcesForTemplate> {

0 commit comments

Comments
 (0)