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

Avoid use of this.attrs for closure actions #6680

Merged
merged 1 commit into from
Apr 9, 2016

Conversation

kevinansfield
Copy link
Member

no issue

@novaugust
Copy link
Contributor

Both of the links you provide are just saying to not use this.attrs for non-closure-action attributes, but that actions are okay.
But I guess the point of what you're getting at is

to avoid confusion and potential unexpected behaviour we should avoid using it

@kevinansfield
Copy link
Member Author

@novaugust yeah, for sure this.attrs for closure actions will work fine but it's an exception specifically for closure actions.

I've seen the this.get('foo')() or get(this, 'foo')() style being used much more frequently in the ember community recently and we even have mentors advising contributors to avoid the this.attrs style as seen in #6325 (comment). If we're choosing one style and sticking with it I'd prefer to fall on the side of the community adopted approach 😄

@@ -8,7 +8,7 @@ export default ModalComponent.extend({
confirm() {
this.set('submitting', true);

this.attrs.confirm().finally(() => {
this.get('confirm').finally(() => {

This comment was marked as abuse.

This comment was marked as abuse.

@acburdine
Copy link
Member

@kevinansfield Couple of minor bugs, fix those and this is 👍

no issue
- `this.attrs` is a glimmer-component thing (which doesn't exist in Ghost yet), to avoid confusion we should avoid using it
- https://locks.svbtle.com/to-attrs-or-not-to-attrs
- cibernox/ember-power-select#233 (comment)
@kevinansfield kevinansfield force-pushed the cleanup-attrs-actions branch from 923433d to eb1cf51 Compare April 9, 2016 09:46
@kevinansfield
Copy link
Member Author

@acburdine Thanks, fixed the bug and added a regression test 😄

@acburdine acburdine merged commit 3b8414e into TryGhost:master Apr 9, 2016
@acburdine acburdine deleted the cleanup-attrs-actions branch April 9, 2016 16:25
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.

3 participants