Skip to content

Commit 315e784

Browse files
committed
Fix filtering when searching for languages in app-hosted mode (BL-15822)
1 parent ef39cc0 commit 315e784

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/components/appHosted/AppHostedLanguageGroup.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,16 @@ export const AppHostedLanguageGroup: React.FunctionComponent = () => {
104104
getItemProps: (options: GetItemPropsOptions<any>) => {},
105105
getMenuProps: (options: GetMenuPropsOptions) => {}
106106
) => {
107-
languagesToDisplay = getLanguagesMatchingSearchTerm(searchTerm).filter(
108-
(lang) => preferredLangCodes.indexOf(lang.isoCode) < 0
109-
);
107+
const matchingLanguages = getLanguagesMatchingSearchTerm(searchTerm);
108+
languagesToDisplay = matchingLanguages;
109+
if (showPreferredLangs) {
110+
// Filter out favorites from the main list so we don't show the same language twice.
111+
// Note: it is important not to do this when favorites are hidden; else they won't show at all. BL-15822
112+
languagesToDisplay = matchingLanguages.filter(
113+
(lang) => !preferredLangCodes.includes(lang.isoCode)
114+
);
115+
}
116+
110117
const prefColor = commonUI.colors.bloomRed;
111118
// if (!showAll && languagesToDisplay.length > 10) {
112119
// languagesToDisplay.splice(10);

0 commit comments

Comments
 (0)