TryGhost/express-hbs

registerAsyncHelper doesn't work when used as a subexpression

bradvogel opened this issue · 1 comments

The following code doesn't work - "testing!" gets displayed:

{{#if (myHelper)}}
   testing!
{{/if}}
  hbs.registerAsyncHelper('myHelper', function(options, cb) {
    setTimeout(function(){
        cb(false /* Don't show */);
    }, 2000);
  });

However if the helper is declared synchronous, it will work:

  hbs.registerHelper('myHelper', function(options, cb) {
    return false;
  });

I'd expect the asynchronous helper to work like the synchronous helper.

Hi @bradvogel - this is a known issue with the async helpers, there's an issue open about it here.

Unfortunately async helpers are quite limited. Until recently you couldn't register a block helper that was async - this is now possible but you cannot nest them. Working on it slowly :)