From 21804e3987c7b82fc4e1a8d0599d357fe6dbf624 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Tue, 30 Mar 2021 22:36:24 +0700 Subject: [PATCH] fix(gatsby-plugin-mdx): timeToRead returns NaN when word count is 0 (#30489) (#30563) (cherry picked from commit 75e234ac9116e16fbd177d24f3b98d7c14409b4e) Co-authored-by: Joe Milne --- 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, } }