From 1555234496b2e381ce71d50a8f829c1dae83f229 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 14 Jan 2022 14:58:34 -0800 Subject: [PATCH] cleanup callbacks at the end instead of the beginning (#34391) --- .../src/steps/preview/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/gatsby-source-wordpress/src/steps/preview/index.ts b/packages/gatsby-source-wordpress/src/steps/preview/index.ts index 0db2b9de4344f..1ac8008503887 100644 --- a/packages/gatsby-source-wordpress/src/steps/preview/index.ts +++ b/packages/gatsby-source-wordpress/src/steps/preview/index.ts @@ -358,12 +358,6 @@ export const sourcePreviews = async (helpers: GatsbyHelpers): Promise => { dump(webhookBody) } - // in case there are preview callbacks from our last build - await invokeAndCleanupLeftoverPreviewCallbacks({ - status: `GATSBY_PREVIEW_PROCESS_ERROR`, - context: `Starting sourcePreviews`, - }) - const wpGatsbyPreviewNodeManifestsAreSupported = await remoteSchemaSupportsFieldNameOnTypeName({ typeName: `GatsbyPreviewData`, @@ -445,4 +439,10 @@ export const sourcePreviews = async (helpers: GatsbyHelpers): Promise => { } await Promise.all([queue.onEmpty(), queue.onIdle()]) + + // clean up leftover callbacks at the end to clean up anything we didn't catch elsewhere + await invokeAndCleanupLeftoverPreviewCallbacks({ + status: `GATSBY_PREVIEW_PROCESS_ERROR`, + context: `Starting sourcePreviews`, + }) }