Skip to content

[Glimmer2] Support id as alias to elementId#13478

Closed
asakusuma wants to merge 1 commit intoemberjs:masterfrom
asakusuma:component-id
Closed

[Glimmer2] Support id as alias to elementId#13478
asakusuma wants to merge 1 commit intoemberjs:masterfrom
asakusuma:component-id

Conversation

@asakusuma
Copy link
Contributor

@asakusuma asakusuma commented May 11, 2016

@chadhietala
Copy link
Contributor

LGTM /cc @krisselden @chancancode

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong place to do it IMO. I don't think we want to actually allow setting this.id on the instance – we have to rename the id arg to elementId on the way in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming it in CurlyComponentMananger.create throws a Changing a view's elementId after creation is not allowed error. I don't quite understand the difference between doing it in CurlyComponentMananger.create vs where it is now in view_support. To me, both seem to be allowing id setting per instance. Which seems to be what's expected anyways.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a big difference, in that we want to isolate all of normalizing of component props to one place. If this didn't work there there is something odd happening in the curly component manager that needs to be addressed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion – github attached the comment to one line above. I meant to say that we shouldn't have to do this.id || guidFor(this); at this point – because we should already have normalized it to elementId by now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We convert the args to a "creation props" pojo that we pass to Component.create(...). That pojo should contain elementId, not id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured out the problem. I didn't realize my alias code was getting run on update as well as creation. Seems to work fine now.

@chancancode
Copy link
Member

👍 LGTM. I'll merge this into #13490 since I refactored the params processing code

@homu
Copy link
Contributor

homu commented May 13, 2016

☔ The latest upstream changes (presumably #13490) made this pull request unmergeable. Please resolve the merge conflicts.

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

Successfully merging this pull request may close these issues.

5 participants