From 9d86edb302519702d2e2d3683d69a338ffb887f0 Mon Sep 17 00:00:00 2001 From: "kl.nevermore" Date: Tue, 6 Aug 2024 19:46:47 +0800 Subject: [PATCH] fix:#6987 Dropdown filter freezes screen (#6991) --- components/lib/dropdown/Dropdown.js | 4 ++++ components/lib/dropdown/DropdownPanel.js | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/lib/dropdown/Dropdown.js b/components/lib/dropdown/Dropdown.js index 1d98fb1703..ca0cb1e871 100644 --- a/components/lib/dropdown/Dropdown.js +++ b/components/lib/dropdown/Dropdown.js @@ -989,6 +989,10 @@ export const Dropdown = React.memo( } }, [overlayVisibleState, filterState, props.filter]); + useUpdateEffect(() => { + virtualScrollerRef.current && virtualScrollerRef.current.scrollInView(0); + }, [filterState]); + useUpdateEffect(() => { if (filterState && (!props.options || props.options.length === 0)) { setFilterState(''); diff --git a/components/lib/dropdown/DropdownPanel.js b/components/lib/dropdown/DropdownPanel.js index 0ac2945cd7..48a375f91d 100644 --- a/components/lib/dropdown/DropdownPanel.js +++ b/components/lib/dropdown/DropdownPanel.js @@ -50,7 +50,6 @@ export const DropdownPanel = React.memo( }; const onFilterInputChange = (event) => { - props.virtualScrollerRef.current && props.virtualScrollerRef.current.scrollToIndex(0); props.onFilterInputChange && props.onFilterInputChange(event); };