meteor / meteor/blaze

Handle async code

Open
#364 20 comments 8 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
543
Forks
117
Avg merge
6h 18m
Merged PRs (30d)
2

Description

Blaze currently auto-calls functions:

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

```html

{{#with asyncTest}}{{this.foo}}{{/with}}

```

will lead to `bar` as output.

However, changing `foo` to an async function like so

```js
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

Contributor guide

Open the contributing guide

Research direction

Start with the JavaScript helper and Blaze template examples in the issue, reproducing the current `[object Promise]` output and comparing it with the synchronous `bar` result. Trace how helper return values are rendered across the relevant template contexts; done means supported Promise values render their resolved output rather than a pending Promise string.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.