Skip to content

Commit

Permalink
⚡ remove reduntant memoization of isLimitReached
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Oct 7, 2024
1 parent 4554639 commit 5d37e32
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,9 @@ const SelectedOptionsProvider = ({
[customOptions, onToggleSelected, removeCustomOption],
);

const isLimitReached = useMemo(() => {
return (
(!!maxSelected?.limit && selectedOptions.length >= maxSelected.limit) ||
(!isMultiSelect && selectedOptions.length > 0)
);
}, [maxSelected, selectedOptions, isMultiSelect]);
const isLimitReached =
(!!maxSelected?.limit && selectedOptions.length >= maxSelected.limit) ||
(!isMultiSelect && selectedOptions.length > 0);

// biome-ignore lint/correctness/useExhaustiveDependencies: We explicitly want to run this effect when selectedOptions changes to match the view with the selected options.
useEffect(() => {
Expand Down

0 comments on commit 5d37e32

Please sign in to comment.