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

[Templating] UndefinedLiteral Coerced To Null #14016

Closed
chadhietala opened this issue Aug 3, 2016 · 6 comments
Closed

[Templating] UndefinedLiteral Coerced To Null #14016

chadhietala opened this issue Aug 3, 2016 · 6 comments
Labels

Comments

@chadhietala
Copy link
Contributor

Currently in both rendering engines UndefinedLiterals are coerced to null. This seems incorrect, however there may be application code that is dependent on this incorrectness, which may lead to non-obvious breakages.

Example:

{{foo-helper undefined}}
function fooHelper(params, hash) {
  assert(params[0] === null);
}

This issue is a placeholder to see if anybody is surprised by this or has code that coerces null back into undefined.

@mitchlloyd
Copy link
Contributor

I was surprised by this recently when writing a helper test to handle undefined values. I had to use {{my-helper nothing}} instead of {{my-helper undefined}}. Now I know why :)

My vote would be to change the behavior to pass the expected undefined value. Although it could be breaking, relying on {{foo-helper undefined}} being coerced to null would most likely be an accident.

@chadhietala
Copy link
Contributor Author

@mitchlloyd This is my predicament as well.

@pixelhandler
Copy link
Contributor

@chadhietala does glimmerjs/glimmer-vm#252 resolve this issue?

@chadhietala
Copy link
Contributor Author

No waiting on glimmerjs/glimmer-vm#255

@chadhietala
Copy link
Contributor Author

glimmerjs/glimmer-vm#255 has landed but I want to keep this open until we bump the version on glimmer.

@rwjblue
Copy link
Member

rwjblue commented Aug 13, 2016

Closed by #14060

@rwjblue rwjblue closed this as completed Aug 13, 2016
bmeurant pushed a commit to bmeurant/ember-array-contains-helper that referenced this issue Sep 9, 2016
New glimmer engines makes difference between null and undefined values. Note that previous behaviour
was an accident (cf. emberjs/ember.js#14016)
This commit updates tests to reflect that.
Was necessary to add conditional tests depending on the ember version. This version check relies on
the ``ember-version-is`` addon.
bmeurant pushed a commit to bmeurant/ember-array-contains-helper that referenced this issue Sep 9, 2016
New glimmer engines makes difference between null and undefined values. Note that previous behaviour
was an accident (cf. emberjs/ember.js#14016)
This commit updates tests to reflect that.
Was necessary to add conditional tests depending on the ember version. This version check relies on
the ``ember-version-is`` addon.
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