glimmer-vm icon indicating copy to clipboard operation
glimmer-vm copied to clipboard

if expression does not prevent evaluation of values

Open sukima opened this issue 4 years ago • 1 comments

I discovered that (Ember 3.25) when I attempted to prevent the (fn …) from helper from evaluating to prevent the non-function assertion it still evaluated.

<MyComponent @myAction={{if @maybeFunction (fn @maybeFunction "foobar")}} />

Expected

To allow the value for @myAction to resolve to undefined.

Actual

An assertion is thrown:

Error: You must pass a function as the fn helpers first argument, you passed undefined.

sukima avatar Feb 01 '22 16:02 sukima

I think this is a duplicate of this ember issue? https://github.com/emberjs/ember.js/issues/19610

It seems the docs explicitly mention this behavior so it works as intended :smile:.

Windvis avatar Feb 16 '22 14:02 Windvis