Skip to content

Commit

Permalink
fix(gatsby): pull out a few bug fixes from #28149 (#28186) (#28188)
Browse files Browse the repository at this point in the history
* fix(gatsby): pull out a few bug fixes from #28149

* Add missing fix

(cherry picked from commit f9fd11d)

Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
  • Loading branch information
vladar and KyleAMathews committed Nov 19, 2020
1 parent 4b9cd2e commit a5131bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/gatsby/cache-dir/loader.js
Expand Up @@ -568,5 +568,9 @@ export const publicLoader = {
export default publicLoader

export function getStaticQueryResults() {
return instance.staticQueryDb
if (instance) {
return instance.staticQueryDb
} else {
return {}
}
}
2 changes: 1 addition & 1 deletion packages/gatsby/src/services/initialize.ts
Expand Up @@ -71,7 +71,7 @@ This will help the dev environment more closely mimic builds so you'll catch bui
Try out develop SSR *today* by running your site with it enabled:
GATSBY_EXPERIMENT_DEV_SSR=true gatsby develop
GATSBY_EXPERIMENTAL_DEV_SSR=true gatsby develop
Please let us know how it goes good, bad, or otherwise at gatsby.dev/dev-ssr-feedback
`,
Expand Down
4 changes: 4 additions & 0 deletions packages/gatsby/src/utils/dev-ssr/render-dev-html.ts
Expand Up @@ -3,6 +3,7 @@ import _ from "lodash"

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

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

// Ensure the query has been run and written out.
await getPageDataExperimental(pageObj.path)

try {
const htmlString = await worker.renderHTML({
path,
Expand Down

0 comments on commit a5131bd

Please sign in to comment.