Skip to content

Commit

Permalink
cleanup callbacks at the end instead of the beginning (#34391)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBarnes authored Jan 14, 2022
1 parent 2e13ad0 commit 1555234
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/gatsby-source-wordpress/src/steps/preview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,6 @@ export const sourcePreviews = async (helpers: GatsbyHelpers): Promise<void> => {
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`,
Expand Down Expand Up @@ -445,4 +439,10 @@ export const sourcePreviews = async (helpers: GatsbyHelpers): Promise<void> => {
}

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`,
})
}

0 comments on commit 1555234

Please sign in to comment.