Skip to content

Commit 0d111a2

Browse files
committed
If an custom typed option is in the list, check the item instead
1 parent 4c99751 commit 0d111a2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

apps/webapp/app/components/onboarding/TechnologyPicker.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,22 @@ export function TechnologyPicker({
210210

211211
const addCustomValue = useCallback(() => {
212212
const trimmed = otherInputValue.trim();
213-
if (trimmed && !customValues.includes(trimmed) && !value.includes(trimmed)) {
213+
if (!trimmed) return;
214+
215+
const matchedOption = TECHNOLOGY_OPTIONS.find(
216+
(opt) => opt.toLowerCase() === trimmed.toLowerCase()
217+
);
218+
219+
if (matchedOption) {
220+
if (!value.includes(matchedOption)) {
221+
onChange([...value, matchedOption]);
222+
}
223+
} else if (!customValues.includes(trimmed) && !value.includes(trimmed)) {
214224
onCustomValuesChange([...customValues, trimmed]);
215-
setOtherInputValue("");
216225
}
217-
}, [otherInputValue, customValues, onCustomValuesChange, value]);
226+
227+
setOtherInputValue("");
228+
}, [otherInputValue, customValues, onCustomValuesChange, value, onChange]);
218229

219230
const handleOtherKeyDown = useCallback(
220231
(e: React.KeyboardEvent) => {

0 commit comments

Comments
 (0)