Skip to content

Commit

Permalink
fix(gatsby): fix node manifest processing in inc builds (#32538)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBarnes committed Aug 5, 2021
1 parent e0e2ecb commit 1577f9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 11 additions & 1 deletion packages/gatsby/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "../utils/websocket-manager"
import { GraphQLRunner } from "./graphql-runner"
import { IGroupedQueryIds } from "../services"
import { processNodeManifests } from "../utils/node-manifest"

if (process.env.GATSBY_EXPERIMENTAL_QUERY_CONCURRENCY) {
console.info(
Expand Down Expand Up @@ -227,7 +228,7 @@ export async function processPageQueries(
queryIds: IGroupedQueryIds["pageQueryIds"],
{ state, activity, graphqlRunner, graphqlTracing }
): Promise<void> {
return processQueries<IGatsbyPage>({
const processedQueries = await processQueries<IGatsbyPage>({
queryIds,
createJobFn: createPageQueryJob,
onQueryDone: undefined,
Expand All @@ -236,6 +237,15 @@ export async function processPageQueries(
graphqlRunner,
graphqlTracing,
})

if (process.env.NODE_ENV !== `development`) {
/**
* only process node manifests here when not in develop. for gatsby develop we process node manifests in src/query/query-watcher.ts everytime queries are re-run. Because we process node manifests in this location for gatsby build we have all the information needed to create the manifests. In query-watcher during gatsby build we might not have all information about created pages and queries.
*/
await processNodeManifests()
}

return processedQueries
}

function createPageQueryJob(
Expand Down
8 changes: 0 additions & 8 deletions packages/gatsby/src/services/run-page-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
CancelExperimentNoticeCallbackOrUndefined,
} from "../utils/show-experiment-notice"
import { isCI } from "gatsby-core-utils"
import { processNodeManifests } from "../utils/node-manifest"

const ONE_MINUTE = 1 * 60 * 1000

Expand Down Expand Up @@ -73,13 +72,6 @@ modules.exports = {
graphqlTracing: program?.graphqlTracing,
})

if (process.env.NODE_ENV !== `development`) {
/**
* only process node manifests here when not in develop. for gatsby develop we process node manifests in src/query/query-watcher.ts everytime queries are re-run. Because we process node manifests in this location for gatsby build we have all the information needed to create the manifests. In query-watcher during gatsby build we might not have all information about created pages and queries.
*/
await processNodeManifests()
}

if (cancelNotice) {
cancelNotice()
}
Expand Down

0 comments on commit 1577f9b

Please sign in to comment.