File tree Expand file tree Collapse file tree 1 file changed +3
-20
lines changed
superset-frontend/packages/superset-ui-core/src/components/Select Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ import {
27
27
ClipboardEvent ,
28
28
Ref ,
29
29
ReactElement ,
30
- useRef ,
31
30
} from 'react' ;
32
31
33
32
import { ensureIsArray , t , usePrevious } from '@superset-ui/core' ;
@@ -137,8 +136,6 @@ const Select = forwardRef(
137
136
) ;
138
137
const [ onChangeCount , setOnChangeCount ] = useState ( 0 ) ;
139
138
const previousChangeCount = usePrevious ( onChangeCount , 0 ) ;
140
- const cancelRef = useRef < ( ( ) => void ) | null > ( null ) ;
141
- const isMounted = useRef ( true ) ;
142
139
const fireOnChange = useCallback (
143
140
( ) => setOnChangeCount ( onChangeCount + 1 ) ,
144
141
[ onChangeCount ] ,
@@ -403,26 +400,12 @@ const Select = forwardRef(
403
400
onSearch ?.( searchValue ) ;
404
401
} , Constants . FAST_DEBOUNCE ) ;
405
402
406
- useEffect (
407
- ( ) => ( ) => {
408
- isMounted . current = false ;
409
- } ,
410
- [ ] ,
411
- ) ;
412
-
413
403
useEffect ( ( ) => {
414
- cancelRef . current = handleOnSearch . cancel ;
404
+ if ( handleOnSearch !== undefined ) {
405
+ handleOnSearch . cancel ( ) ;
406
+ }
415
407
} , [ handleOnSearch ] ) ;
416
408
417
- useEffect (
418
- ( ) => ( ) => {
419
- if ( ! isMounted . current ) {
420
- cancelRef . current ?.( ) ;
421
- }
422
- } ,
423
- [ ] ,
424
- ) ;
425
-
426
409
const handleOnDropdownVisibleChange = ( isDropdownVisible : boolean ) => {
427
410
setIsDropdownVisible ( isDropdownVisible ) ;
428
411
You can’t perform that action at this time.
0 commit comments