Closed renato-zannon closed 8 years ago
Is this supposed to "just work", as if I had written
in the first place?
It should work as if you had invoked the glimmer component with angles. @Serabe was going to take a peek at this in spare time. Since angles are behind a FF we haven't been in a huge rush. But yeah, coordinating with @Serabe and helping with this would be welcome :-)
It seems to work alright if I use
{{component "<my-angle-component>"}}
Haha, that is insane. That should not work. :smile:
Also vaguely related is creating components with closures and ensuring those work: {{component (component 'some-glimmer-comp')}}
@mixonic Great! I'll try to whip up a PR in the next few days. From what I've seen it doesn't look too difficult :)
It seems to work alright if I use {{component "
"}} Haha, that is insane. That should not work.
Technically, it is fine (and what is actually expected by the component-node-manager).
If we want to allow {{component
helper to invoke either angle bracket or curly bracket components we need a little more thought than just removing the assertion.
For example, when using {{component 'foo-bar' baz=blah}}
this.attrs.baz
would be a mutable object (because we auto-wrap with (mut
helper in all curly bracket invocations).
@rwjblue Thanks for chiming in!
If we want to allow {{component helper to invoke either angle bracket or curly bracket components we need a little more thought than just removing the assertion.
I wasn't thinking about removing the assertion. Instead I intended to investigate whether it would be possible to make it work as if I had passed {{component "<my-angle-component>"}}
. I do see your point about mutability though, so I assume this falls on the "needs higher level discussion" (and maybe RFC) category?
I wasn't thinking about removing the assertion. Instead I intended to investigate whether it would be possible to make it work as if I had passed {{component "
"}}.
@renato-zannon - Ya, I wasn't trying to suggest you would take an improper shortcut. The fix for this specific thing (not requiring folks use <foo-bar>
vs foo-bar
) would be to make the node manager understand three states: curly, angle, and "doesn't matter", but we really need to nail down the mutability scenario before tackling that.
this falls on the "needs higher level discussion" (and maybe RFC) category?
I don't really think it needs an RFC, but I would like one of the angle bracket implementers to chime in so we can choose a path forward.
@wycats / @tomdale / @chancancode - What are your thoughts on angle brackets invoked from {{component 'foo-bar' blah=baz}}
? Should app/components/foo-bar.js
be allowed to be an Ember.GlimmerComponent
? Should this.attrs.blah
be a mutable object or not? Other thoughts....
I believe there was consensus that a GlimmerComponent could be used, and that auto-mut would not apply (normal glimmer component semantics).
I believe there was consensus that a GlimmerComponent could be used, and that auto-mut would not apply (normal glimmer component semantics).
A few notes:
{{component
is for a Ember.Component
and another is for a Ember.GlimmerComponent
. (mut
has been applied, we have no way currently to know if (mut
was added by the auto-mut infrastructure or by the user in their template. This means that we cannot make {{component
or (component
"fix" (by removing the mutable object) the attrs. This could be fixed by adding a flag to (mut
in the auto-mut.Sorry for the delay. Tomorrow I'll be catching a flight to India, I'll b there for two weeks and quite likely I'll have time to address this.
So far, I like @rwjblue's idea of marking the automut and "unboxing" it. On Fri, 13 Nov 2015 at 20:49, Robert Jackson notifications@github.com wrote:
I believe there was consensus that a GlimmerComponent could be used, and that auto-mut would not apply (normal glimmer component semantics).
A few notes:
- Auto-mut happens as a compilation step, where we have absolutely no knowledge of the target. IOW, we don't know that one invocation of {{component is for a Ember.Component and another is for a Ember.GlimmerComponent.
- At runtime after auto-(mut has been applied, we have no way currently to know if (mut was added by the auto-mut infrastructure or by the user in their template. This means that we cannot make {{component or (component "fix" (by removing the mutable object) the attrs. This could be fixed by adding a flag to (mut in the auto-mut.
— Reply to this email directly or view it on GitHub https://github.com/emberjs/ember.js/issues/12590#issuecomment-156539889.
I am closing this issue as angle bracket components are currently being revisited and this issue might not be relevant anymore. Feel free to re-open the issue if you think it's still justified, thank you!
I'm experimenting with porting some components to angle bracket style in canary, and ended up stumbling on this. When I use
{{component "my-angle-component"}}
Ember errors out with:which suggests that the
{{component}}
code path hasn't been prepared for angle components yet.So, my questions are:
<my-angle-component>
in the first place? Or is there some higher-level definition pending to decide what the behavior should be?Update: It seems to work alright if I use
{{component "<my-angle-component>"}}
(with requires someconcat
ing, in my case). Not sure if this is intentional though, I wasn't able to find any explicit tests for this case