This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree 1 file changed +5
-2
lines changed
client/src/components/SuggestionBox
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import config from "../../config";
4
4
import api from "../../services/api" ;
5
5
import style from "./style.module.scss" ;
6
6
7
+ const NO_RESULTS_FOUND = "no results found" ;
8
+
7
9
/**
8
10
* Decides what is displayed after the user selects a suggestion
9
11
* @param {Object } suggestion The selected suggestion
@@ -88,7 +90,8 @@ export default function SuggestionBox({
88
90
89
91
const onSuggestionsFetchRequested = async ( { value } ) => {
90
92
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 } ] ;
92
95
setSuggestions ( data ) ;
93
96
} else {
94
97
const data = await getCompanyAttributesSuggestions (
@@ -104,7 +107,7 @@ export default function SuggestionBox({
104
107
105
108
const onSuggestionSelected = ( event , { suggestion } ) => {
106
109
if ( purpose === "skills" ) {
107
- onSelect ( suggestion ) ;
110
+ if ( suggestion . name !== NO_RESULTS_FOUND ) onSelect ( suggestion ) ;
108
111
} else {
109
112
onSelect ( companyAttrId , suggestion ) ;
110
113
}
You can’t perform that action at this time.
0 commit comments