From 75e234ac9116e16fbd177d24f3b98d7c14409b4e Mon Sep 17 00:00:00 2001 From: Joe Milne Date: Fri, 26 Mar 2021 18:30:08 +0000 Subject: [PATCH] fix(gatsby-plugin-mdx): timeToRead returns NaN when word count is 0 (#30489) --- packages/gatsby-plugin-mdx/gatsby/source-nodes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/gatsby-plugin-mdx/gatsby/source-nodes.js b/packages/gatsby-plugin-mdx/gatsby/source-nodes.js index 04971a3f8fdb7..f07aab4f9e640 100644 --- a/packages/gatsby-plugin-mdx/gatsby/source-nodes.js +++ b/packages/gatsby-plugin-mdx/gatsby/source-nodes.js @@ -44,9 +44,9 @@ async function getCounts({ mdast }) { } return { - paragraphs: counts.ParagraphNode, - sentences: counts.SentenceNode, - words: counts.WordNode, + paragraphs: counts.ParagraphNode || 0, + sentences: counts.SentenceNode || 0, + words: counts.WordNode || 0, } }