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

Positional params issue in contextual components #12625

Closed
mike183 opened this issue Nov 18, 2015 · 3 comments
Closed

Positional params issue in contextual components #12625

mike183 opened this issue Nov 18, 2015 · 3 comments

Comments

@mike183
Copy link
Contributor

mike183 commented Nov 18, 2015

An assertion is being triggered when attempting to use positional params with contextual components via the hash helper.

Imagine the following

{{!-- templates/components/parent-component.hbs --}}
{{yield (hash childComponent=(component "child-component"))}}
// components/child-component.js
import Ember from 'ember';

const childComponent = Ember.Component.extend({});

childComponent.reopenClass({
  positionalParams: "params"
});

export default childComponent;

If we attempt to instantiate childComponent directly, the assertion is triggered, if we instantiate childComponent using the component helper, everything works as expected. See below for examples:

{{!-- Not Working --}}
{{#parent-component as |hash|}}
  {{hash.childComponent "param1" "param2"}}
{{/parent-component}}

{{!-- Working --}}
{{#parent-component as |hash|}}
  {{component hash.childComponent "param1" "param2"}}
{{/parent-component}}

I've also created a couple of Twiddles, one showing the error and one showing it working when used with the component helper.

Working:
https://ember-twiddle.com/331b165b525660a2307d

Not Working:
https://ember-twiddle.com/cef32d9fc97b265e824b

The assertion being thrown is:

Uncaught Error: Assertion Failed: You cannot specify positional parameters and the hash argument `params`.

I discovered the issue on v2.3.0-beta.1 although I suspect the issue could also affect v2.2.0.

@Serabe
Copy link
Member

Serabe commented Nov 18, 2015

I think I know what's happening. If I'm right, it would be a quick fix. I'm having dinner, I'll check later.

@mixonic
Copy link
Member

mixonic commented Nov 18, 2015

This feature does not exist in 2.2, so it would be a [BUGFIX beta]. It seems like this is related to params being an internal we use. Definitely a bug.

@mike183
Copy link
Contributor Author

mike183 commented Nov 18, 2015

This feature does not exist in 2.2, so it would be a [BUGFIX beta].

Of course! My mistake.

Serabe added a commit to Serabe/ember.js that referenced this issue Nov 19, 2015
… syntax

As reported in emberjs#12625, positional parameters were not being rendered correctly
when using the dot syntax. A longer description on the cause of the problem has
been added as a comment to `ember-htmlbars/lib/hooks/component.js` for future
warning.

Fix emberjs#12625
rwjblue pushed a commit that referenced this issue Nov 19, 2015
… syntax

As reported in #12625, positional parameters were not being rendered correctly
when using the dot syntax. A longer description on the cause of the problem has
been added as a comment to `ember-htmlbars/lib/hooks/component.js` for future
warning.

Fix #12625

(cherry picked from commit a18490a)
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

No branches or pull requests

3 participants