@@ -158,10 +158,6 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
158
158
159
159
// >>> Disabled Strategy
160
160
const disabledStrategy = ( node : DataNode ) => {
161
- // if (node.disabled) {
162
- // return true;
163
- // }
164
-
165
161
if ( isOverMaxCount ) {
166
162
const selectedValues = displayValues ?. map ( v => v . value ) || [ ] ;
167
163
if ( ! selectedValues . includes ( node [ fieldNames . value ] ) ) {
@@ -309,13 +305,15 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
309
305
onKeyUp : ( ) => { } ,
310
306
} ) ) ;
311
307
312
- const loadDataFun = useMemo (
313
- ( ) => ( searchValue ? null : ( loadData as any ) ) ,
308
+ const hasLoadDataFn = useMemo (
309
+ ( ) => ( searchValue ? false : true ) ,
314
310
[ searchValue , treeExpandedKeys || expandedKeys ] ,
315
311
( [ preSearchValue ] , [ nextSearchValue , nextExcludeSearchExpandedKeys ] ) =>
316
312
preSearchValue !== nextSearchValue && ! ! ( nextSearchValue || nextExcludeSearchExpandedKeys ) ,
317
313
) ;
318
314
315
+ const syncLoadData = hasLoadDataFn ? loadData : null ;
316
+
319
317
const onActiveChange = ( key : Key ) => {
320
318
if ( ! isOverMaxCount ) {
321
319
setActiveKey ( key ) ;
@@ -364,7 +362,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
364
362
showIcon = { showTreeIcon }
365
363
switcherIcon = { switcherIcon }
366
364
showLine = { treeLine }
367
- loadData = { loadDataFun }
365
+ loadData = { syncLoadData }
368
366
motion = { treeMotion }
369
367
activeKey = { activeKey }
370
368
// We handle keys by out instead tree self
0 commit comments