-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Bug] Arguments are lost when passed to Glimmer components via the {{component}} helper #19061
Comments
This is strange indeed! |
One thing to note (generally speaking) is that you probably should not use As an aside, ember-template-lint@2 (current release) removes all "stylistic" rules (I recall you disliking the preferences RE: attribute/block indentation) and the recommended set focuses on prevent actual bugs (similarly to what eslint's recommended does now). |
Ok good to know! And yes it was just for purposes of boiling it down to simplest example. In my EmberMap demo I was accessing this.args in an action (for purposes of routing). That’s ok right? Also good to know re: updates to template-lint! |
Yep, absolutely! And regardless of |
To add to this strangeness, adding any one of a large subset of characters (any alphanumeric character, Even more strange, this seems to work if you stick to the See the forked gist here with more arguments to highlight the difference: https://ember-twiddle.com/e8ada6977f22dcd91e2f533d9f654106?openFiles=templates.application%5C.hbs%2Ctemplates.components.my-component%5C.hbs |
I also found this issue. After some debugging I found that all the attributes are passed, however the first character is removed for all the attributes after the first one. e.g. {{component "my-component"
first=1
second=2
third=3
}} will have the hash {
first: 1,
econd: 2,
hird: 3
} Right now adding an extra character to the rest of the attributes, while not ideal, works fine. |
Because iterator was not working as expected. `@` character was not applied to all of the @arg names in hash array, except for the first argument. It resulted in `[["@firstArg", "secondArg"], ["valOne", "valTwo"]]`, instead of `[["@firstArg", "@secondArg"], ["valOne", "valTwo"]]` Fixes emberjs/ember.js#19061
Because iterator was not working as expected. `@` character was not applied to all of the @arg names in hash array, except for the first argument. It resulted in `[["@firstArg", "secondArg"], ["valOne", "valTwo"]]`, instead of `[["@firstArg", "@secondArg"], ["valOne", "valTwo"]]` Fixes emberjs/ember.js#19061
The fix landed upstream, but reopening until we've landed the fix here in Ember. |
🐞 Describe the Bug
The order in which named arguments are passed into the
{{component}}
helper seems to affect the values for corresponding properties on thethis.args
object if the referenced component is a Glimmer component.In particular, all arguments other than the first one passed seem to not end up on the
this.args
object.🔬 Minimal Reproduction
Here's a Twiddle: https://ember-twiddle.com/2fd6f1de858f527a8f29c9f31c4b7c5b?openFiles=templates.application%5C.hbs%2Ctemplates.components.my-component%5C.hbs
Note that in the first instance of
my-component
,this.args.one
is "a" andthis.args.two
is undefined, while for the second instance,this.args.one
is undefined andthis.args.two
is "b".The only difference in the two invocations is the order the named arguments are passed.
😕 Actual Behavior
Only the first argument is assigned to the corresponding property on the
this.args
object.🤔 Expected Behavior
All arguments are assigned to their corresponding properties on the
this.args
object.🌍 Environment
The text was updated successfully, but these errors were encountered: