From 3d327db831f354b91dca73ca62b4d26438aa5f64 Mon Sep 17 00:00:00 2001 From: nevermore Date: Tue, 6 Aug 2024 11:25:29 +0800 Subject: [PATCH] fix:#6987 Dropdown filter freezes screen --- 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); };