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

Angle Bracket Components Break if not Hyphenated #632

Open
Alonski opened this issue Jul 10, 2018 · 0 comments
Open

Angle Bracket Components Break if not Hyphenated #632

Alonski opened this issue Jul 10, 2018 · 0 comments

Comments

@Alonski
Copy link

Alonski commented Jul 10, 2018

Twiddle to showcase this bug:
https://ember-twiddle.com/c8c45c5236474e516c7d39e5f7920d12?openFiles=templates.application.hbs%2Ctemplates.components.my-angel.hbs

Currently using angle-bracket-component-polyfill work but not completely.
When doing this: <MyAngel /> I get: "Assertion Failed: You cannot use 'MyAngel' as a component name. Component names must contain a hyphen." (edited)
However this works: <My-Angel />

From Slack:

alon [5:47 PM]
Hmm friends, for some reason `angle-bracket-component-polyfill` doesn't completely work in a twiddle
When doing this: `<MyAngel />` I get: `"Assertion Failed: You cannot use 'MyAngel' as a component name. Component names must contain a hyphen."` (edited)
However this works: `<My-Angel />`

knownasilya [5:48 PM]
sounds like we might have an extra check somewhere?

gaurav0 [5:50 PM]
we do
https://github.com/ember-cli/ember-twiddle/search?q=hyphen&unscoped_q=hyphen

knownasilya [5:52 PM]
If we could check for the presence of the polyfill, we could remove that requirement

gaurav0 [5:55 PM]
https://github.com/rwjblue/ember-angle-bracket-invocation-polyfill#limitations

gaurav0 [5:57 PM]
I'm pretty sure <MyAngel> invocation requires a file name of my-angel.js / my-angel.hbs even with the polyfill

gaurav0 [5:58 PM]
And I think we only check the file name provided.

gaurav0 [6:01 PM]
Ok. The error is coming from ember-source, not ember-twiddle (edited)

alon [6:03 PM]
Ok interesting. Maybe the polyfill does something extra to convert non hyphened to hyphened

gaurav0 [6:10 PM]
Yes, it seems to do an ast transform at template precompile time: https://github.com/rwjblue/ember-angle-bracket-invocation-polyfill/blob/master/lib/ast-transform.js
I suppose it could be possible to do this at compile time if addon is detected, I do something like that for hbs``

rwjblue [9:11 PM]
ya, we also need to remove the hyphen requirement when running Ember 3.4+

gaurav0 [9:34 PM]
@rwjblue Would it make sense to just remove the requirement entirely from Twiddle and let Ember itself deal however it does? My concern was that in some versions of Ember the component silently didn't render and in others you get the helper name not found error.

rwjblue [9:48 PM]
AFAIK all semi recent versions of Ember should at least give you an assertion (edited)
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

1 participant