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:28078 Search message shows Invalid email when typing email addres… #29741

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/CategoryPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function CategoryPicker({selectedCategory, policyCategories, policyRecentlyUsedC
return categoryInitialFocusedIndex;
}, [selectedCategory, searchValue, isCategoriesCountBelowThreshold, sections]);

const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, searchValue);
const headerMessage = OptionsListUtils.getHeaderMessageForNonUserList(lodashGet(sections, '[0].data.length', 0) > 0, searchValue);
const shouldShowTextInput = !isCategoriesCountBelowThreshold;

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/TagPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function TagPicker({selectedTag, tag, policyTags, policyRecentlyUsedTags, onSubm
[searchValue, selectedOptions, policyTagList, policyRecentlyUsedTagsList],
);

const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, '');
const headerMessage = OptionsListUtils.getHeaderMessageForNonUserList(lodashGet(sections, '[0].data.length', 0) > 0, '');

return (
<OptionsSelector
Expand Down
14 changes: 14 additions & 0 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,19 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma

return '';
}
/**
DylanDylann marked this conversation as resolved.
Show resolved Hide resolved
* Helper method that check if any search results match, and show the not found message.
DylanDylann marked this conversation as resolved.
Show resolved Hide resolved
*
* @param {Boolean} hasSelectableOptions
* @param {String} searchValue
* @return {String}
*/
function getHeaderMessageForNonUserList(hasSelectableOptions, searchValue) {
if (searchValue && !hasSelectableOptions) {
return Localize.translate(preferredLocale, 'common.noResultsFound');
}
return '';
}

/**
* Helper method to check whether an option can show tooltip or not
Expand All @@ -1545,6 +1558,7 @@ export {
getShareDestinationOptions,
getMemberInviteOptions,
getHeaderMessage,
getHeaderMessageForNonUserList,
getPersonalDetailsForAccountIDs,
getIOUConfirmationOptionsFromPayeePersonalDetail,
getIOUConfirmationOptionsFromParticipants,
Expand Down
Loading