I expected the callbackGenerator to return a function, and this function to be called when childTemplate calls it.
But what actually happens is that the function returned is getting immediatly called. It doesn’t happen with callbacks without parameters though.
To fix that, we have to write this:
Yes that what’s we are doing, but in my opinion this is a bug!
Because if you don’t pass any parameter is working perfectly.
And using two functions to return one is super ugly.
My question is: is there anyway to do it without two functions?
The thing is that is executing both functions, the helper and the returned
function.
In my opinion, this is a bug. Is calling the value returned by the helper.
That’s weird
Any of the @meteor core could say something about that? I would write a PR
to fix this if it is not done on purpose for any reason.
For me it seems that the Spacebars parser is doing something like this:
<template name="example">
{{#let variable=(helper param)}} => {{#let variable=functionReturned}} ( in Spacebars functions are called just by naming them)
{{/let}}
</template>
What I mean is that when using parenthesis, Spacebars is doing an intermediate step, replacing the expression between parenthesis for what it returns, and then is compiling again the template.
Without parenthesis is not happening because it compiles it directly. Thats what I supose