Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): pull out a few bug fixes from https://github.com/gatsbyjs/gatsby/pull/28149/ (#28186) #28188

Merged
merged 1 commit into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/gatsby/cache-dir/loader.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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