Open nickschot opened 6 years ago
Ah, make sense. I think we would fix this in animated-value. Currently it essentially passes items=[value]
to animated-each
, but when value is null we should pass items=[]
.
My apologies, but now that I think more about it, I was wrong in my comment above.
null
is a valid value that you may want to render and animate.
For example:
{{#animated-value myPreference as |pref|}}
{{#if pref}}
Your preference is {{pref}}.
{{else}}
You have not chosen a preference.
{{/if}}
{{/animated-value}}
While it would be possible to make animated-value
accept its own {{else}}
block, that's a complication I would rather avoid, when you can achieve the same thing as above without learning a new concept.
So instead I think we should add guards where we try to use the key
property to access properties on the possibly-null value.
@ef4 sure, i will investigate this weekend.
When using ember-elsewhere you might not always want to provide a defined value (e.g. a page where nothing should be rendered in the elsewhere). Currently when passing an undefined value to an
animated-value
and at the same time providing akey
attribute throws aAssertion Failed: Cannot call get with 'text' on an undefined object.
Seems to be originating from https://github.com/ember-animation/ember-animated/blob/master/addon/components/animated-each.js#L88