@@ -95,9 +95,11 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
95
95
96
96
// ========================== Scroll Effect ==========================
97
97
React . useEffect ( ( ) => {
98
+ // Single mode should scroll to current key
98
99
if ( open && ! multiple && checkedKeys . length ) {
99
100
treeRef . current ?. scrollTo ( { key : checkedKeys [ 0 ] } ) ;
100
101
}
102
+ // eslint-disable-next-line react-hooks/exhaustive-deps
101
103
} , [ open ] ) ;
102
104
103
105
// ========================== Events ==========================
@@ -155,13 +157,13 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
155
157
if ( searchValue ) {
156
158
setSearchExpandedKeys ( getAllKeys ( treeData , fieldNames ) ) ;
157
159
}
160
+ // eslint-disable-next-line react-hooks/exhaustive-deps
158
161
} , [ searchValue ] ) ;
159
162
160
163
// ========================== Flatten Tree Data ==========================
161
164
const flattenedTreeData = React . useMemo ( ( ) => {
162
- const expandKeys = searchValue ? true : mergedExpandedKeys ;
163
- return flattenTreeData ( memoTreeData , expandKeys , fieldNames ) ;
164
- } , [ memoTreeData , searchValue , mergedExpandedKeys ] ) ;
165
+ return flattenTreeData ( memoTreeData , mergedExpandedKeys , fieldNames ) ;
166
+ } , [ memoTreeData , mergedExpandedKeys ] ) ;
165
167
166
168
// ========================== Get First Selectable Node ==========================
167
169
const getFirstMatchingNode = ( searchVal ?: string ) : EventDataNode < any > | null => {
0 commit comments