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

[Bugfix] {{#with}} helper should not render if passed variable is falsey #11035

Merged
merged 1 commit into from
May 7, 2015
Merged

[Bugfix] {{#with}} helper should not render if passed variable is falsey #11035

merged 1 commit into from
May 7, 2015

Conversation

joeruello
Copy link
Contributor

Tried out Glimmer in my app and found that {{#with bar as |foo|}} blocks would still render their templates if bar is falsey, which on release, they don't. Thought I would have a go at a fix.

JSBins: Release - Canary

First actual code PR so, let me know if their's anything additional I need to do.

@joeruello
Copy link
Contributor Author

Was looking around and saw #10961 and ##11019.

Looks like in 1.10, {{#with}} would not render the template if the value was null or undefined, but would render 0, "" and false. I think this is the behaviour is Ember.isNone()?

1.11 changed it to a pure falsey check, which is what my PR is based off.

I couldn't find this behavior documented anywhere except for a maybe a cryptic comment on the API docs // posts might not be. So I'm not sure what to do :)

rwjblue added a commit that referenced this pull request May 7, 2015
[Bugfix] {{#with}} helper should not render if passed variable is falsey
@rwjblue rwjblue merged commit a69f48b into emberjs:master May 7, 2015
@rwjblue
Copy link
Member

rwjblue commented May 7, 2015

Thank you!

@rwjblue
Copy link
Member

rwjblue commented May 7, 2015

Shoot, I forgot to ask, would you mind submitting another PR adding to the API docs?

@joeruello
Copy link
Contributor Author

Sure, happy to.

Before I do, is the 1.11 behaviour correct? Should we be checking for falsey or just null and undefined?

@rwjblue
Copy link
Member

rwjblue commented May 7, 2015

I like that this PR makes it the same truthiness as {{if}}. That makes it pretty easy to understand and consistent with the rest of the system.

@joeruello
Copy link
Contributor Author

Great, will get another PR up soon.
On 7 May 2015 10:46 pm, "Robert Jackson" notifications@github.com wrote:

I like that this PR makes it the same truthiness as {{if}}. That makes it
pretty easy to understand and consistent with the rest of the system.


Reply to this email directly or view it on GitHub
#11035 (comment).

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

Successfully merging this pull request may close these issues.

2 participants