Skip to content

Handle async code #364

Open
Open
@jankapunkt

Description

@jankapunkt

Blaze currently auto-calls functions:

Template.example.helpers({
  asyncTest () {
    return {
      foo: () => 'bar'
    }
  }
})
<template name="example">
  {{#with asyncTest}}{{this.foo}}{{/with}}
</template>

will lead to bar as output.

However, changing foo to an async function like so

Template.example.helpers({
  asyncTest () {
    return {
      foo: async () => 'bar'
    }
  }
})

we will get for the same Template a toString output of a pending Promise: [object Promise]

However, we should be able to handle Promises in 2022 in any context. This would imply a huge PR but I think this is a crucial candidate for Blaze 3 and the future of Blaze

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions