From ec2a7fb19f301ea38cc5bddacb1b62049b088805 Mon Sep 17 00:00:00 2001 From: gizeasy Date: Thu, 11 Jun 2026 14:27:31 +0300 Subject: [PATCH] fix(Combobox): fix searchLabel and virtualScroll on React 19 closes #4177 closes #3971 --- .../SelectDropdown/SelectDropdown.tsx | 1 + src/hooks/useVirtualScroll/helpers.ts | 2 +- src/utils/getGroups.ts | 20 ++++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx b/src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx index 7b0e4bb53..0abba20ce 100644 --- a/src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx +++ b/src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx @@ -232,6 +232,7 @@ export const SelectDropdown: SelectDropdownComponent = (props) => { }), cnMixScrollBar(), ])} + key={cnSelectDropdown('ScrollContainer')} ref={dropdownRef} > {isLoading && !isListShowed && } diff --git a/src/hooks/useVirtualScroll/helpers.ts b/src/hooks/useVirtualScroll/helpers.ts index 2d325ca58..0e22524d7 100644 --- a/src/hooks/useVirtualScroll/helpers.ts +++ b/src/hooks/useVirtualScroll/helpers.ts @@ -36,7 +36,7 @@ export const useScroll = ( return () => { ref.current?.removeEventListener('scroll', fn); }; - }, [ref.current, fn, isActive]); + }, [ref.current, isActive]); }; export const getElementHeight = (el: HTMLElement | SVGGraphicsElement | null) => diff --git a/src/utils/getGroups.ts b/src/utils/getGroups.ts index 1807680f7..e81ef5d8a 100644 --- a/src/utils/getGroups.ts +++ b/src/utils/getGroups.ts @@ -125,15 +125,17 @@ export function getCountedGroups( checkedCount += 1; } }); - copyGroups[index].items = [ - { - __optionSelectAll: true, - totalCount, - groupKey: group.key, - checkedCount, - }, - ...copyGroups[index].items, - ]; + copyGroups[index].items = copyGroups[index].items.length + ? [ + { + __optionSelectAll: true, + totalCount, + groupKey: group.key, + checkedCount, + }, + ...copyGroups[index].items, + ] + : copyGroups[index].items; }); } return copyGroups;