From da88626208b37fa3265be058c164fa6c46b9b535 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Sat, 4 Jan 2025 19:21:49 +0530 Subject: [PATCH] Fix scrolling of country page --- src/components/SelectionList/BaseSelectionList.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index d5935d698a17..bcf9a33fc2b7 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -652,8 +652,9 @@ function BaseSelectionList( useEffect(() => { // Avoid changing focus if the textInputValue remains unchanged. if ( - (prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength && !shouldUpdateFocusedIndex) || - flattenedSections.allOptions.length === 0 + (prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) || + flattenedSections.allOptions.length === 0 || + (flattenedSections.selectedOptions.length !== prevSelectedOptionsLength && shouldUpdateFocusedIndex) ) { return; }