Skip to content

Commit

Permalink
Use by for custom deep compare
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Jan 22, 2025
1 parent cc7415b commit 607d218
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/js/common/Select/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { Listbox, Transition } from '@headlessui/react';
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid';

import classNames from 'classnames';
import { find, get } from 'lodash';
import { find, get, isEqual } from 'lodash';

export const OPTION_ALL = 'all';

const defaultOnChange = () => {};
const defaultRenderOption = (item) => item.value;

const deepCompareSelection=(optionValue, value) => isEqual(optionValue, value);

function Select({
optionsName,
options,
Expand Down Expand Up @@ -42,6 +44,7 @@ function Select({
disabled={disabled}
value={value}
onChange={onChange}
by={deepCompareSelection}
>
<div className="relative">
<Listbox.Button
Expand Down

0 comments on commit 607d218

Please sign in to comment.