Handle async code
- 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
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