@@ -78,6 +78,8 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
78
78
( prev , next ) => next [ 0 ] && prev [ 1 ] !== next [ 1 ] ,
79
79
) ;
80
80
81
+ const memoDisplayValues = React . useMemo ( ( ) => displayValues ?. map ( v => v . value ) , [ displayValues ] ) ;
82
+
81
83
// ========================== Values ==========================
82
84
const mergedCheckedKeys = React . useMemo ( ( ) => {
83
85
if ( ! checkable ) {
@@ -159,7 +161,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
159
161
// >>> Disabled Strategy
160
162
const disabledStrategy = ( node : DataNode ) => {
161
163
if ( isOverMaxCount ) {
162
- const selectedValues = displayValues ?. map ( v => v . value ) || [ ] ;
164
+ const selectedValues = memoDisplayValues ;
163
165
if ( ! selectedValues . includes ( node [ fieldNames . value ] ) ) {
164
166
return true ;
165
167
}
@@ -214,7 +216,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
214
216
215
217
React . useEffect ( ( ) => {
216
218
const nodes : EventDataNode < any > [ ] = [ ] ;
217
- const selectedValueSet = new Set ( displayValues ?. map ( v => v . value ) ) ;
219
+ const selectedValueSet = new Set ( memoDisplayValues ) ;
218
220
219
221
const collectNodes = ( nodeList : EventDataNode < any > [ ] ) => {
220
222
nodeList . forEach ( node => {
@@ -231,7 +233,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
231
233
232
234
collectNodes ( memoTreeData ) ;
233
235
availableNodesRef . current = nodes ;
234
- } , [ displayValues , memoTreeData ] ) ;
236
+ } , [ memoDisplayValues , memoTreeData ] ) ;
235
237
236
238
// ========================== Active ==========================
237
239
const [ activeKey , setActiveKey ] = React . useState < Key > ( null ) ;
0 commit comments