Skip to content

Commit 374f7da

Browse files
committed
fix inputmultiselect placeholder
1 parent 95881ce commit 374f7da

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/apps/talent-search/src/lib/utils/search-query.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from 'react'
1+
import { useCallback, useEffect, useState } from 'react'
22
import { useSearchParams } from 'react-router-dom'
33

44
import { Skill } from '~/libs/shared'
@@ -24,10 +24,10 @@ export const useUrlQuerySearchParms = (paramName: string): [
2424

2525
const [skills, setSkills] = useState<Skill[]>([])
2626

27-
function handleUpdateSearch(newSkills: Skill[]): void {
27+
const handleUpdateSearch = useCallback((newSkills: Skill[]) => {
2828
const searchParams = encodeUrlQuerySearch(newSkills)
2929
updateParams(`${searchParams}`)
30-
}
30+
}, [updateParams])
3131

3232
// update search input whenever the url data changes
3333
useEffect(() => {

src/libs/ui/lib/components/form/form-groups/form-input/input-multiselect/InputMultiselect.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
FC,
44
KeyboardEvent,
55
ReactNode,
6+
useMemo,
67
useRef,
78
} from 'react'
89
import { noop } from 'lodash'
@@ -103,6 +104,10 @@ const InputMultiselect: FC<InputMultiselectProps> = (props: InputMultiselectProp
103104
return !!props.limit && (props.value?.length as number) >= props.limit
104105
}
105106

107+
const ValueContainer = useMemo(() => (
108+
valueContainer(props.additionalPlaceholder ?? 'Add more...')
109+
), [props.additionalPlaceholder])
110+
106111
const selectInputElement = (
107112
<AsyncSelect
108113
className={
@@ -132,7 +137,7 @@ const InputMultiselect: FC<InputMultiselectProps> = (props: InputMultiselectProp
132137
components={{
133138
DropdownIndicator: dropdownIndicator(props.dropdownIcon),
134139
MultiValueRemove,
135-
ValueContainer: valueContainer(props.additionalPlaceholder ?? 'Add more...'),
140+
ValueContainer,
136141
}}
137142
value={props.value}
138143
openMenuOnClick={false}

0 commit comments

Comments
 (0)