handlebars-lang / handlebars-lang/handlebars.js

Bug - Correct Syntax Throwing Error for non empty value in context

Open
#2,034 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
18.7k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

**Syntax**
```hbs
{{#if (name)}}{{/if}}
```

**Throw Error When pass non empty string for name in context**

| Empty value for name in context | Non Empty value for name in context |
|----| --- |
| image | image |

**Error String**

```cmd
(lookupProperty(...) || (depth0 && lookupProperty(...)) || container.hooks.helperMissing).call is not a function

Error: (lookupProperty(...) || (depth0 && lookupProperty(...)) || container.hooks.helperMissing).call is not a function
at t._callbacks. (https://handlebarsjs.com/assets/js/8.214167ea.js:1:61688)
at n (https://handlebarsjs.com/assets/js/8.214167ea.js:1:61432)
at Worker. (https://handlebarsjs.com/assets/js/8.214167ea.js:1:61536)
```

> _Same Happening for unless helper too_

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported Handlebars syntax with both empty and non-empty name values, then compare the generated behavior for the if and unless helpers. No repository file or test is named in the issue, so first locate the helper invocation and its existing regression tests. Done means non-empty values no longer throw and both helpers behave consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars, javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.