Skip to content

Commit 4c23314

Browse files
committed
chore: optimized code logic
1 parent f737832 commit 4c23314

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/OptionList.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
8080
(prev, next) => next[0] && prev[1] !== next[1],
8181
);
8282

83-
const memoDisplayValues = React.useMemo(
83+
const memoRawValues = React.useMemo(
8484
() => (displayValues || []).map(v => v.value),
8585
[displayValues],
8686
);
@@ -164,10 +164,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
164164
}, [searchValue]);
165165

166166
const nodeDisabled = useEvent((node: DataNode) => {
167-
if (isOverMaxCount && !memoDisplayValues.includes(node[fieldNames.value])) {
168-
return true;
169-
}
170-
return false;
167+
return isOverMaxCount && !memoRawValues.includes(node[fieldNames.value]);
171168
});
172169

173170
// ========================== Get First Selectable Node ==========================

0 commit comments

Comments
 (0)