Skip to content

Commit e618e4b

Browse files
KyleAMathewsvladar
authored andcommitted
fix(gatsby): pull out a few bug fixes from #28149 (#28186)
* fix(gatsby): pull out a few bug fixes from #28149 * Add missing fix (cherry picked from commit f9fd11d)
1 parent 9869094 commit e618e4b

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/gatsby/cache-dir/loader.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,5 +568,9 @@ export const publicLoader = {
568568
export default publicLoader
569569

570570
export function getStaticQueryResults() {
571-
return instance.staticQueryDb
571+
if (instance) {
572+
return instance.staticQueryDb
573+
} else {
574+
return {}
575+
}
572576
}

packages/gatsby/src/services/initialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ This will help the dev environment more closely mimic builds so you'll catch bui
7171
7272
Try out develop SSR *today* by running your site with it enabled:
7373
74-
GATSBY_EXPERIMENT_DEV_SSR=true gatsby develop
74+
GATSBY_EXPERIMENTAL_DEV_SSR=true gatsby develop
7575
7676
Please let us know how it goes good, bad, or otherwise at gatsby.dev/dev-ssr-feedback
7777
`,

packages/gatsby/src/utils/dev-ssr/render-dev-html.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import _ from "lodash"
33

44
import { startListener } from "../../bootstrap/requires-writer"
55
import { findPageByPath } from "../find-page-by-path"
6+
import { getPageData as getPageDataExperimental } from "../get-page-data"
67

78
const startWorker = (): any => {
89
const newWorker = new JestWorker(require.resolve(`./render-dev-html-child`), {
@@ -63,6 +64,9 @@ export const renderDevHTML = ({
6364
isClientOnlyPage = true
6465
}
6566

67+
// Ensure the query has been run and written out.
68+
await getPageDataExperimental(pageObj.path)
69+
6670
try {
6771
const htmlString = await worker.renderHTML({
6872
path,

0 commit comments

Comments
 (0)