File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
apps/talent-search/src/lib/utils
libs/ui/lib/components/form/form-groups/form-input/input-multiselect Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1- import { useEffect , useState } from 'react'
1+ import { useCallback , useEffect , useState } from 'react'
22import { useSearchParams } from 'react-router-dom'
33
44import { 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 ( ( ) => {
Original file line number Diff line number Diff line change 33 FC ,
44 KeyboardEvent ,
55 ReactNode ,
6+ useMemo ,
67 useRef ,
78} from 'react'
89import { 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 }
You can’t perform that action at this time.
0 commit comments