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 - JS error "values of undefined" on a missing reference in a column #751

Merged
merged 1 commit into from
Oct 29, 2015

Conversation

kenegozi
Copy link
Contributor

fixes #750

scope.value = scope.entry.values[scope.field.name()];
scope.value = typeof scope.entry === 'undefined'
? ''
: scope.entry.values[scope.field.name()];
Copy link
Contributor

Choose a reason for hiding this comment

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

scope.value = scope.entry.values ? scope.entry.values[scope.field.name()] : ''; is better IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not that .values is undefined, it's that .entry is undefined, so the one-liner will still end up with Uncaught TypeError: Cannot read property 'values' of undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as for relying on truethiness vs. checking typeof, this could turn into a holy war which is far from my intent, so whichever is consistent with the project's guidelines is fine by me.

@kenegozi kenegozi closed this Oct 26, 2015
@kenegozi kenegozi reopened this Oct 26, 2015
@fzaninotto
Copy link
Member

I really don't understand why the build fails on this PR. I've restarted it three times.

Could you try rebasing on master?

@kenegozi
Copy link
Contributor Author

rebased, still same failure. I have no idea what's causing it.

fzaninotto added a commit that referenced this pull request Oct 29, 2015
fix - JS error "values of undefined" on a missing reference in a column
@fzaninotto fzaninotto merged commit b75ba9e into marmelab:master Oct 29, 2015
@fzaninotto
Copy link
Member

OK, merging with hope that the faulty CI worker was only on your branch...

@kenegozi
Copy link
Contributor Author

Thanks.

This is so weird. I can't explain it.

@kenegozi kenegozi deleted the missing-reference branch October 29, 2015 13:34
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.

reference field column - js error on missing entry
3 participants