-
Notifications
You must be signed in to change notification settings - Fork 137
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
{{div}} divide helper from ember-math-helpers breaks with 2.x with use of <div> tags #1320
Comments
@ztjohns can you please confirm if using |
Sure thing, let me do a few examples and I will post something. |
The following scenarios in addition to the
It seems like simply using the |
I think the issue is that, starting with When using the first-class templates syntax it would look similar to this: import div from 'ember-math-helpers/helpers/div';
<template>
{{#let (div @a @b) as |c|}}
<div>{{c}}</div>
{{/let}}
</template> This version would have the same issue, with the exception that you can simply rename the helper import so it doesn't conflict with the element name anymore. import divide from 'ember-math-helpers/helpers/div';
... So I think the issue is that Embroider adds references into the template scope while they might conflict with native element names. Before strict mode templates it wasn't really possible to get into this situation since all references would be prefixed with |
I think @Windvis is right and we need to check for collisions with native events in lexical scope. |
I could also easily rename this helper in ember-math-helpers, which might be a good thing to do. |
Yeah, we should fix the bug but renaming the helper is also good, because even if embroider automatically avoids the collision, users writing in first-class template syntax would still need to remember to avoid the collision. |
I was recently testing Embroider in one of our apps and encountered a similar case with the I re-exported the helper under another name in our app and used the updated name to work around the issue. (just documenting the issue here since other people might run into it as well) |
this class of issues should be fixed on latest unstable npm releases, we're also working on adding tests specifically for this type of case, I'll make sure to add await to the list |
Yes, the exact fix was here: embroider/packages/compat/src/resolver-transform.ts Lines 620 to 622 in e7c1789
(And while the comment says it avoids collision with html elements, this also necessarily avoids collision with javascript keywords like |
Hello, when using ember-math-helpers in templates after turning on Embroider 2.0.2 we get the following errors from components that use this divide helper.
Example
Temp Solution
Fortunately we only used this in two places, so I am moving all the computation in JS instead.
Expectation
It to work as normal
The text was updated successfully, but these errors were encountered: