Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
satyajitnayk opened this issue Jul 5, 2024 · 4 comments
Open
Labels

Comments

@satyajitnayk
Copy link

satyajitnayk commented Jul 5, 2024

Syntax

{{#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

   (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.<computed> (https://handlebarsjs.com/assets/js/8.214167ea.js:1:61688)
    at n (https://handlebarsjs.com/assets/js/8.214167ea.js:1:61432)
    at Worker.<anonymous> (https://handlebarsjs.com/assets/js/8.214167ea.js:1:61536)

Same Happening for unless helper too

@satyajitnayk satyajitnayk changed the title Correct Syntax Throwing Error for non empty value in context Bug - Correct Syntax Throwing Error for non empty value in context Jul 5, 2024
@jaylinski jaylinski added the bug label Jul 6, 2024
@tiholic
Copy link

tiholic commented Aug 5, 2024

I too faced the same issue

@satyajitnayk
Copy link
Author

Same is observed in other helpers too . This should be addressed as soon as possible as it could cause severe issue for whoever is using handlebars in production. Thoughts @jaylinski ?🤔

For example lookup helper

Same Error when there is non empty string in merge key:
image

No Error when merge context key is empty string:
image

@mohd-akram
Copy link
Contributor

Do not wrap name in (). Parentheses are for sub-expressions. See the documentation.

@satyajitnayk
Copy link
Author

Parser should throw error for syntax itself right?
but it is not doing so & only throwing at compilation with merge context!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants