Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix liquid template argument parsing and shortcode undefined values #2367

Merged
merged 1 commit into from
May 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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