From 607d218c4da081f6a02b6cb7826161b5207e882c Mon Sep 17 00:00:00 2001 From: EMaksy Date: Fri, 17 Jan 2025 17:14:39 +0100 Subject: [PATCH] Use by for custom deep compare --- assets/js/common/Select/Select.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/js/common/Select/Select.jsx b/assets/js/common/Select/Select.jsx index da2610bd83..fe1c06ea1e 100644 --- a/assets/js/common/Select/Select.jsx +++ b/assets/js/common/Select/Select.jsx @@ -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, @@ -42,6 +44,7 @@ function Select({ disabled={disabled} value={value} onChange={onChange} + by={deepCompareSelection} >