Skip to content

Commit e8637b5

Browse files
Peter BengtssonOctomerger
andauthored
exit early in renderContent() on empty template (#22979)
Part of #1187 Co-authored-by: Octomerger Bot <63058869+Octomerger@users.noreply.github.com>
1 parent ca61413 commit e8637b5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/render-content/renderContent.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const inlineTagRegex = new RegExp(`\n?(</?${inlineTagString}>?)\n?`, 'gm')
1717

1818
// parse multiple times because some templates contain more templates. :]
1919
async function renderContent(template = '', context = {}, options = {}) {
20+
// If called with a falsy template, it can't ever become something
21+
// when rendered. We can exit early to save some pointless work.
22+
if (!template) return template
2023
try {
2124
// remove any newlines that precede html comments, then remove the comments
2225
if (template) {

0 commit comments

Comments
 (0)