handlebars-lang / handlebars-lang/handlebars.js
Context within partials with arguments is acting weird
- Dominant language
- JavaScript
- Stars
- 18.7k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
`{{#block_helper1}}`
` {{#block_helper2}}`
` {{#if true}}`
`{{#*inline "newInlineTest" argumentKey="argumentValue"}}{{../block_helper_1_attribute}}{{/inline}}`
` {{>newInlineTest}}`
` {{/if}}`
` {{/block_helper2}}`
`{{/block_helper2}}`
For the above use case `newInlineTest` partial fetches the result from `block_helper2` instead of `block_helper1`.
However if I change the inline to `{{#*inline "newInlineTest"}}{{parent.block_helper_1_attribute}}{{/inline}}` then it fetches the result from `block_helper1` like it is expected to.
Seems like `../` and `parent.` are not behaving the same way for partials with arguments
Contributor guide
Research direction
Start by reproducing the nested block and inline-partial example from the issue in handlebars.js, then trace how partial arguments resolve ../ versus parent. Done means the inline partial resolves block_helper1's attribute consistently with the parent. form and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100