Skip to content

Commit

Permalink
Fix: Time to Read block showing "this block has encountered an error" -
Browse files Browse the repository at this point in the history
#61459 (#61614)

* Fix the issue related to replace method for undefined, replace it with optional chaining so undefined can be prevented

* Revert the optional chaining commit for the wordcount pacakges

* Pass empty string if we get content undefined in time to read block

Unlinked contributors: bradhogan.

Co-authored-by: hbhalodia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
  • Loading branch information
3 people authored May 14, 2024
1 parent 0d5d45f commit f5b456a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/post-time-to-read/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function PostTimeToReadEdit( { attributes, setAttributes, context } ) {
const minutesToRead = Math.max(
1,
Math.round(
wordCount( content, wordCountType ) / AVERAGE_READING_RATE
wordCount( content || '', wordCountType ) / AVERAGE_READING_RATE
)
);

Expand Down

0 comments on commit f5b456a

Please sign in to comment.