Skip to content

Commit

Permalink
Merge pull request #2367 from epelc/master
Browse files Browse the repository at this point in the history
fix liquid template argument parsing and shortcode undefined values
  • Loading branch information
zachleat authored May 6, 2022
2 parents bece436 + 9399a86 commit 9657b43
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Engines/Liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ class Liquid extends TemplateEngine {
line: 1,
col: 1 }*/
if (arg.type.indexOf("ignore:") === -1) {
argArray.push(await engine.evalValue(arg.value, scope));
// Push the promise into an array instead of awaiting it here.
// This forces the promises to run in order with the correct scope value for each arg.
// Otherwise they run out of order and can lead to undefined values for arguments in layout template shortcodes.
argArray.push(engine.evalValue(arg.value, scope));
}
arg = lexer.next();
}
}

return argArray;
return await Promise.all(argArray);
}

static _normalizeShortcodeScope(ctx) {
Expand Down

0 comments on commit 9657b43

Please sign in to comment.