Skip to content

Commit

Permalink
chore: optimized code logic
Browse files Browse the repository at this point in the history
  • Loading branch information
aojunhao123 committed Dec 3, 2024
1 parent f737832 commit 4c23314
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/OptionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
(prev, next) => next[0] && prev[1] !== next[1],
);

const memoDisplayValues = React.useMemo(
const memoRawValues = React.useMemo(
() => (displayValues || []).map(v => v.value),
[displayValues],
);
Expand Down Expand Up @@ -164,10 +164,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
}, [searchValue]);

const nodeDisabled = useEvent((node: DataNode) => {
if (isOverMaxCount && !memoDisplayValues.includes(node[fieldNames.value])) {
return true;
}
return false;
return isOverMaxCount && !memoRawValues.includes(node[fieldNames.value]);
});

// ========================== Get First Selectable Node ==========================
Expand Down

0 comments on commit 4c23314

Please sign in to comment.