Skip to content

Fixed search for invalid label and/or value#2179

Merged
JedWatson merged 3 commits intoJedWatson:masterfrom
yuri-sakharov:fix/search-for-invalid-label-value
Nov 28, 2017
Merged

Fixed search for invalid label and/or value#2179
JedWatson merged 3 commits intoJedWatson:masterfrom
yuri-sakharov:fix/search-for-invalid-label-value

Conversation

@yuri-sakharov
Copy link

@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
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
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