Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit c121c2b

Browse files
Merge pull request #570 from topcoder-platform/issue-123
fix issue#123
2 parents ebffc77 + 2cd0cb4 commit c121c2b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

client/src/components/SuggestionBox/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import config from "../../config";
44
import api from "../../services/api";
55
import style from "./style.module.scss";
66

7+
const NO_RESULTS_FOUND = "no results found";
8+
79
/**
810
* Decides what is displayed after the user selects a suggestion
911
* @param {Object} suggestion The selected suggestion
@@ -88,7 +90,8 @@ export default function SuggestionBox({
8890

8991
const onSuggestionsFetchRequested = async ({ value }) => {
9092
if (purpose === "skills") {
91-
const data = await getSkillsSuggestions(apiClient, value);
93+
let data = await getSkillsSuggestions(apiClient, value);
94+
if (data.length < 1) data = [{ name: NO_RESULTS_FOUND }];
9295
setSuggestions(data);
9396
} else {
9497
const data = await getCompanyAttributesSuggestions(
@@ -104,7 +107,7 @@ export default function SuggestionBox({
104107

105108
const onSuggestionSelected = (event, { suggestion }) => {
106109
if (purpose === "skills") {
107-
onSelect(suggestion);
110+
if (suggestion.name !== NO_RESULTS_FOUND) onSelect(suggestion);
108111
} else {
109112
onSelect(companyAttrId, suggestion);
110113
}

0 commit comments

Comments
 (0)