From 9c131e748b9104fea3b053ddca6817c5ba1d38c3 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Fri, 28 May 2021 00:27:58 +0700 Subject: [PATCH] fix(gatsby-source-contentful): fix progress bar (#31467) (cherry picked from commit 2e1f7e325adfe055f828336c247d71404f461be5) --- packages/gatsby-source-contentful/src/fetch.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/gatsby-source-contentful/src/fetch.js b/packages/gatsby-source-contentful/src/fetch.js index 9668b218b2aa2..7bfa57f54a773 100644 --- a/packages/gatsby-source-contentful/src/fetch.js +++ b/packages/gatsby-source-contentful/src/fetch.js @@ -79,6 +79,7 @@ module.exports = async function contentfulFetch({ }) { // Fetch articles. let syncProgress + let syncItemCount = 0 const pageLimit = pluginConfig.get(`pageLimit`) const contentfulClientOptions = { space: pluginConfig.get(`spaceId`), @@ -110,6 +111,8 @@ module.exports = async function contentfulFetch({ !response.isAxiosError && response?.data.items ) { + syncItemCount += response.data.items.length + syncProgress.total = syncItemCount syncProgress.tick(response.data.items.length) }