Allow partial-blocks to be executed without "options"

Closes #1341

If the @partial-block is called as parameter of a helper (like in
{{#if @partial-block}}...{{/if}}, the partialBlockWrapper is executed
without "options"-parameter. It should still work in without an error
in such a case.
This commit is contained in:
Nils Knappmeier
2017-05-02 22:30:59 +02:00
committed by Nils Knappmeier
parent 606fa55b0a
commit a00c598266
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -237,7 +237,8 @@ export function invokePartial(partial, context, options) {
options.data = createFrame(options.data);
// Wrapper function to get access to currentPartialBlock from the closure
let fn = options.fn;
partialBlock = options.data['partial-block'] = function partialBlockWrapper(context, options) {
partialBlock = options.data['partial-block'] = function partialBlockWrapper(context, options = {}) {
// Restore the partial-block from the closure for the execution of the block
// i.e. the part inside the block of the partial call.
options.data = createFrame(options.data);