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

Fix for undefined parent error #111

Merged
merged 2 commits into from
Feb 10, 2017
Merged

Conversation

hsdwayne
Copy link
Contributor

@hsdwayne hsdwayne commented Feb 8, 2017

This fixes the error discussed in this comment 74c4723#commitcomment-20790735

hsdwayne referenced this pull request Feb 9, 2017
Prior to this, all visualization would show would be `Babel`,
after this change we will have `Babel: <project-or-addon-name>`.
index.js Outdated
@@ -120,7 +120,7 @@ module.exports = {
},

_getBabelOptions: function() {
var parentName = typeof this.parent.name === "function" ? this.parent.name() : this.parent.name;
var parentName = typeof this.parent !== 'undefined' ? (typeof this.parent.name === 'function' ? this.parent.name() : this.parent.name) : 'unknown';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a slight tweak:

var parantName;
if (this.parent && typeof this.parent.name === 'function') {
  parentName = this.parent.name();
} else if (this.parent) {
  parentName = this.parent.name;
}

I find it hard to reason about nested ternaries...

parentName = this.parent.name;
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rwjblue Ok, how's this?

@rwjblue rwjblue merged commit 8f976a8 into emberjs:master Feb 10, 2017
@Turbo87 Turbo87 added the bug label Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants