handlebars-lang / handlebars-lang/handlebars.js
{{*inline}} cannot take SubExpressions as arguments
- Dominant language
- JavaScript
- Stars
- 18.7k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
While investigating on #1371, I have noticed, that while
```handlebars
{{#*inline "stuff"}}
MyContents
{{/inline}}
{{> stuff}}
```
obviously works (https://jsfiddle.net/vva7musq/25/), the following template does run into an error when executing the template with `{ some: 'stuff' }` as input:
```handlebars
{{#*inline (some)}}
MyContents
{{/inline}}
{{> stuff}}
```
see https://jsfiddle.net/vva7musq/28/
This should work, shouldn't it? Or is there something I have missed. The error is:
```
helpers is not defined
anonymous@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js line 3670 > Function:5:162
executeDecorators@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js:1340:13
ret@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js:1215:13
ret@https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js:3488:13
window.onload@https://fiddle.jshell.net/_display/:56:49
```
The AST looks fine as far as I can tell.
Contributor guide
Research direction
Start by reproducing the two inline-block templates from the issue with `{ some: 'stuff' }` as input, comparing the literal argument with the `(some)` subexpression. Inspect the generated execution around the reported `helpers is not defined` error and the inline decorator path. Done means the subexpression argument executes without an error and the named inline partial renders as in the working example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100