File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed
packages/gatsby-source-wordpress/src Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { allowFileDownloaderProgressBarToClear } from "./create-nodes/create-rem
1010import { sourcePreviews } from "~/steps/preview"
1111
1212const sourceNodes : Step = async helpers => {
13- const { cache, webhookBody } = helpers
13+ const { cache, webhookBody, refetchAll } = helpers
1414
1515 // if this is a preview we want to process it and return early
1616 if ( webhookBody . preview ) {
@@ -41,6 +41,7 @@ const sourceNodes: Step = async helpers => {
4141 const fetchEverything =
4242 foundUsableHardCachedData ||
4343 ! lastCompletedSourceTime ||
44+ refetchAll ||
4445 // don't refetch everything in development
4546 ( process . env . NODE_ENV !== `development` &&
4647 // and the schema was changed
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { paginatedWpNodeFetch } from "~/steps/source-nodes/fetch-nodes/fetch-nod
66
77import fetchAndCreateNonNodeRootFields from "~/steps/source-nodes/create-nodes/fetch-and-create-non-node-root-fields"
88import { setHardCachedNodes } from "~/utils/cache"
9+ import { sourceNodes } from "~/steps/source-nodes"
910
1011/**
1112 * getWpActions
@@ -60,6 +61,9 @@ export const handleWpActions = async api => {
6061 break
6162 case `NON_NODE_ROOT_FIELDS` :
6263 await fetchAndCreateNonNodeRootFields ( )
64+ break
65+ case `REFETCH_ALL` :
66+ await sourceNodes ( { ...helpers , refetchAll : true } , { } )
6367 }
6468
6569 await setHardCachedNodes ( { helpers } )
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export type GatsbyNodeApiHelpers = NodePluginArgs & {
99 context : any
1010 updatedAt : number
1111 }
12+ refetchAll ?: boolean
1213}
1314export type GatsbyHelpers = GatsbyNodeApiHelpers
1415export type GatsbyReporter = Reporter
You can’t perform that action at this time.
0 commit comments