File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
packages/gatsby-source-wordpress/src/steps
source-nodes/update-nodes/wp-actions Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { formatLogMessage } from "~/utils/format-log-message"
1919import { touchValidNodes } from "../source-nodes/update-nodes/fetch-node-updates"
2020
2121import { Reporter } from "gatsby/reporter"
22+ import { invokeAndCleanupLeftoverPreviewCallbacks } from "./cleanup"
2223
2324const inDevelopPreview =
2425 process . env . NODE_ENV === `development` &&
@@ -367,14 +368,11 @@ export const sourcePreviews = async (helpers: GatsbyHelpers): Promise<void> => {
367368 dump ( webhookBody )
368369 }
369370
370- if ( previewForIdIsAlreadyBeingProcessed ( webhookBody ?. id ) ) {
371- if ( inPreviewDebugMode ) {
372- reporter . info (
373- `Preview for id ${ webhookBody ?. id } is already being sourced.`
374- )
375- }
376- return
377- }
371+ // in case there are preview callbacks from our last build
372+ await invokeAndCleanupLeftoverPreviewCallbacks ( {
373+ status : `GATSBY_PREVIEW_PROCESS_ERROR` ,
374+ context : `Starting sourcePreviews` ,
375+ } )
378376
379377 const wpGatsbyPreviewNodeManifestsAreSupported =
380378 await remoteSchemaSupportsFieldNameOnTypeName ( {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export const fetchAndCreateSingleNode = async ({
2424 cachedNodeIds,
2525 token = null ,
2626 isPreview = false ,
27+ isDraft = false ,
2728 userDatabaseId = null ,
2829} ) => {
2930 function getNodeQuery ( ) {
@@ -34,7 +35,7 @@ export const fetchAndCreateSingleNode = async ({
3435 // if it's a preview but it's the initial blank node
3536 // then use the regular node query as the preview query wont
3637 // return anything
37- const query = isPreview ? previewQuery : nodeQuery
38+ const query = isPreview && ! isDraft ? previewQuery : nodeQuery
3839
3940 return query
4041 }
@@ -81,6 +82,16 @@ export const fetchAndCreateSingleNode = async ({
8182 )
8283 )
8384
85+ reporter . info ( {
86+ singleName,
87+ id,
88+ actionType,
89+ cachedNodeIds,
90+ token,
91+ isPreview,
92+ userDatabaseId,
93+ } )
94+
8495 return { node : null }
8596 }
8697
You can’t perform that action at this time.
0 commit comments