File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import { PLACEHOLDERS, RJSF_FORM_SELECT_PORTAL_TARGET_ID } from '../constants'
1919
2020import { deepEqual } from '@Common/Helper'
2121import { SelectPicker } from '@Shared/Components'
22+ import { useEffect , useState } from 'react'
23+ import { getUniqueId } from '@Shared/Helpers'
2224
2325export const SelectWidget = ( props : WidgetProps ) => {
2426 const {
@@ -42,13 +44,22 @@ export const SelectWidget = (props: WidgetProps) => {
4244 onChange ( multiple ? option . map ( ( o ) => o . value ) : option . value )
4345 }
4446
47+ const [ key , setKey ] = useState < string > ( )
48+
49+ useEffect ( ( ) => {
50+ // NOTE: need to trigger a re-render after re-mount since react-select
51+ // has an issue with menuPortalTarget after re-mounting
52+ setKey ( getUniqueId ( 8 ) )
53+ } , [ ] )
54+
4555 const getOption = ( value ) =>
4656 multiple
4757 ? selectOptions . filter ( ( option ) => value . some ( ( val ) => deepEqual ( val , option . value ) ) )
4858 : selectOptions . find ( ( option ) => deepEqual ( value , option . value ) )
4959
5060 return (
5161 < SelectPicker
62+ key = { key }
5263 inputId = { `devtron-rjsf-select__${ id } ` }
5364 name = { id }
5465 isMulti = { multiple }
You can’t perform that action at this time.
0 commit comments