From 6cc964a7d7831580be6825ef9f0130d94f9795c5 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 18 Oct 2021 22:35:39 -0700 Subject: [PATCH] fix(gatsby-source-wordpress): restore PQR support (#33590) --- .../src/steps/ingest-remote-schema/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/index.js b/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/index.js index b5296c4fe4066..16141743929a0 100644 --- a/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/index.js +++ b/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/index.js @@ -9,12 +9,15 @@ import { buildNodeQueries } from "./build-queries-from-introspection/build-node- import { cacheFetchedTypes } from "./cache-fetched-types" import { writeQueriesToDisk } from "./write-queries-to-disk" +/** + * This fn is called during schema customization. + * It pulls in the remote WPGraphQL schema, caches it, + * then builds queries and stores a transformed object + * later used in schema customization. + * + * This fn must run in all PQR workers. + */ const ingestRemoteSchema = async (helpers, pluginOptions) => { - // don't ingest schema while in worker - use cache instead - if (process.env.GATSBY_WORKER_POOL_WORKER) { - return - } - if (process.env.NODE_ENV === `development`) { // running this code block in production is problematic for PQR // since this fn will run once for each worker and we need the result in each