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
Ember 2.9.0 beta: Yielded value using with-helper in component block form breaks if null or undefined #14326
Comments
Thank you for your report! |
The previous `ValueReference` implementation does not handle edge cases in its `get` method very well. For example, `new ValueReference(5).get("foo").get("bar")` errors, causing bugs like emberjs/ember.js#14326. Instead of trying to fix the general case, we made `PrimitiveReference` public instead. This should cover the majority of the `ValueReference` use cases, and the host could implement its own reference type for the rest.
The previous `ValueReference` implementation does not handle edge cases in its `get` method very well. For example, `new ValueReference(5).get("foo").get("bar")` errors, causing bugs like emberjs/ember.js#14326. Instead of trying to fix the general case, we made `PrimitiveReference` public instead. This should cover the majority of the `ValueReference` use cases, and the host could implement its own reference type for the rest.
Currently on ember 2.10.0 and this bug seems to still be alive; consider the following twiddle: https://ember-twiddle.com/18868df4738de43f6fdf99885dd53419?openFiles=templates.application.hbs%2C Notably, the following handlebars snippet behaves incorrectly {{#with false as |x|}}
I should render, but I'm not {{x}}
{{/with}} |
The problem in your twiddle is that you are using different version in Furthermore, that template should not render the text. As stated in the documentation:
Thank you! |
Thanks @Serabe, I was unaware |
Subject (and issue explanation) was slightly hard to come up with, sorry about that.
In short, the issue appears when yielding a value in component and referring to the value's property in the components block form in
with-helper
, if the given value is either null or undefined. This issue did not exist in Ember 2.8.1, so I'm assuming this has something to do with Glimmer 2. Here is a Ember Twiddle to demonstrate the issue: https://ember-twiddle.com/386db48506ac762153a3675bd6a39576/f4742940fc186cba83e70b5a235a7934ae84b379?openFiles=templates.application.hbs%2C . The issue can be seen via console, where a error should occur when switching Ember dependency tobeta
(and no error when switching torelease
).As a practical use case, I'm using a
async-render component
which takes a promise as source property and internally uses aEmber.PromiseProxyMixin
object, essentially rendering the content once the promise has resolved. If the promise had not resolved yet (theprop.isFulfilled
was false), the component template would yield null. Thewith-helper
was used to make reading the template a little easier. I acknowledge that this is potentially a design flaw on my part, but Ember 2.8.1 allowed this behavior, so a confirmation would be nice whether this is intended.The text was updated successfully, but these errors were encountered: