handleWpActions = async api => {
  const { cachedNodeIds, helpers } = api

  switch (api.wpAction.actionType) {
    case `DELETE`:
      await wpActionDELETE(api)
      break
    case `UPDATE`:
    case `CREATE`:
      await wpActionUPDATE(api)
      break
    case `NON_NODE_ROOT_FIELDS`:
      await fetchAndCreateNonNodeRootFields()
      break
    case `REFETCH_ALL`:
      await sourceNodes({ ...helpers, refetchAll: true }, {})
  }

  await setHardCachedNodes({ helpers })

  return cachedNodeIds
}
Acts on changes in WordPress to call functions that sync Gatsby with
the latest WP changes