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

Fixed search for invalid label and/or value #2179

Merged
merged 3 commits into from
Nov 28, 2017
Merged

Fixed search for invalid label and/or value #2179

merged 3 commits into from
Nov 28, 2017

Conversation

yuri-sakharov
Copy link
Contributor

@yuri-sakharov yuri-sakharov commented Nov 28, 2017

We have a results in dropdown if user search "undefined" word when value and/or label are undefined or if search "null" word when value and/or label are null.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 93.421% when pulling 2179f88 on yuri-sakharov:fix/search-for-invalid-label-value into 0d0ccd3 on JedWatson:master.

@yuri-sakharov yuri-sakharov changed the title Fix/search for invalid label value Fixed search for invalid label and/or value Nov 28, 2017
var value = option[props.valueKey];
var label = option[props.labelKey];
var hasValue = typeof (value) !== 'undefined' && value !== null && value !== '';
var hasLabel = typeof (label) !== 'undefined' && label !== null && label !== '';

Choose a reason for hiding this comment

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

Maybe extract this logic into a function?

}

var valueTest = hasValue ? String(value) : null;
var labelTest = hasLabel ? String(label) : null;

Choose a reason for hiding this comment

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

Why not include this in the hasX checks?

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 because there is situation when only one of label or value is invalid and still need to search in valid field.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 93.431% when pulling 7e10e30 on yuri-sakharov:fix/search-for-invalid-label-value into 0d0ccd3 on JedWatson:master.

@JedWatson
Copy link
Owner

Thanks for this @yuri-sakharov! Great PR 👍

@JedWatson JedWatson merged commit 75f3043 into JedWatson:master Nov 28, 2017
@yuri-sakharov yuri-sakharov deleted the fix/search-for-invalid-label-value branch November 29, 2017 06:36
@yuri-sakharov
Copy link
Contributor Author

@JedWatson thank you too.

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.

4 participants